我必须在“网格”视图或列表“视图”中显示产品信息。
最初我传递了一个 url,http://localhost/thebestbookfinder.com/viewallbooks/books/pgn/1/grid
但如果我点击分页链接,那么我的 url 将重新启动到http://localhost/thebestbookfinder.com/viewallbooks/books/pgn/1
. 因此,正因为如此,我无法加载我的视图格式数据。如何修复此错误?
这个疑问是我朋友问题的一部分 浏览主要问题链接
MyContoller.php
function books()
{
$config = array();
$config['base_url'] = base_url().'viewallbooks/books/pgn/';
$config["total_rows"] = $this->Booksmodel->record_count_for_secondtopBooks('3');
$config['uri_segment'] = 4;
$config['per_page'] = 3;
$config['full_tag_open'] = '<div id="pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
$page = ($this->uri->segment(4)) ? $this->uri->segment(4) : 0;
$data["query"] = $this->Subjectmodel->get_subjects();
$data["query1"]= $this->Editionmodel->get_edition();
$data["query2"]=$this->Booksmodel->get_all_book_list_atHomeTop('3',$config["per_page"], $page);
$data["links"] = $this->pagination->create_links();
//---------For getting view type and passing to the view to show data accordingly-----
$viewType = ($this->uri->segment(5)) ? $this->uri->segment(5) : 'list';
$data["vt"]=$viewType;
// ----Ends here For getting view type and passing to the view to show data accordingly-----
$this->load->view('commonfiles/booksview',$data);
}