我有一个页面,其中书籍将以“网格”视图或“列表”视图显示。
所以我当前的网址是
http://localhost/thebestbookfinder.com/viewallbooks/books/pgn/grid/8
如果我从我的视图页面单击“列表”链接,那么我的当前页面应该加载,只需将此部分更改/grid/
为/list/
和其他相同。IEhttp://localhost/thebestbookfinder.com/viewallbooks/books/pgn/list/8
我试过这个,但这没有帮助。请帮我解决这个问题。
inMyViewPage.php
<td width="10%" style="font-size:12px;color: red;">
<?php
echo "".anchor('#', 'Grid', array('id' => ''))."";
echo "".anchor(base_url().'viewallbooks/books/pgn/'.$this->uri->segment(4),' List', array('id' => ''))."";
?>
</td>
如果表单提交解决了我的问题,而不是链接,那么请帮助我
控制器.php
function books()
{
$config = array();
$config['base_url'] = base_url().'viewallbooks/books/pgn/'.$this->uri->segment(4);
$config["total_rows"] = $this->Booksmodel->record_count_for_secondtopBooks('3');
$config['uri_segment'] = 5;
$config['per_page'] = 8;
$config['full_tag_open'] = '<div id="pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
$page = ($this->uri->segment(5)) ? $this->uri->segment(5) : 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);
$viewType = ($this->uri->segment(4)) ? $this->uri->segment(4) : 'list';
if($viewType=='list')
{
$this->load->view('commonfiles/bookslistview',$data);
}
else {
$this->load->view('commonfiles/booksgridview',$data);
}
}