我必须在“网格”视图或列表“视图”中显示产品信息。
最初我传递了一个类似http://localhost/thebestbookfinder.com/viewallbooks/books/pgn/1/grid
的网址,但是如果我点击分页链接,那么我的网址会重新启动到http://localhost/thebestbookfinder.com/viewallbooks/books/pgn/1
。因此,因此我无法加载我的视图格式数据。
如何解决此错误?
这个疑问是我朋友问题Browse the main problem link
的一部分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);
}
答案 0 :(得分:2)
将您的base_url
更改为:
$config['base_url'] = base_url().'viewallbooks/books/pgn/grid';
并将您的网址结构更改为:
http://localhost/thebestbookfinder.com/viewallbooks/books/pgn/grid/1
页码应该是网址中的最后一个。