这是第一次使用codeigniter开发的网站,我认为它是一个非常有用的框架。我能够使用网址中的语言创建一个多语言网站。
我点击了这个网站" http://jeromejaglale.com/doc/php/codeigniter_i18n"。
一切正常。问题是我无法操作分页。当我点击链接2转到分页的第二页时,我会重定向到主页。
这是我的链接http://test.lan/en/blog
这是我的分页链接http://test.lan/blog/2
感谢您的帮助。
这是我的代码:
$config['base_url'] = base_url() . 'blog';
$config['total_rows'] = $this->blog_model->countPost('post');
$config['per_page'] = 5;
$config['uri_segment'] = 2;
$choice = $config['total_rows']/$config['per_page'];
$config['num_links'] = round($choice);
$config['full_tag_open'] = '<div id="data-table_paginate" class="dataTables_paginate paging_full_numbers">';
$config['full_tag_close'] = '</div>';
//Customizing the "Digit" Link
$config['num_tag_open'] = '';
$config['num_tag_close'] = '';
//Customizing the "Current Page" Link
$config['cur_tag_open'] = '<a class="paginate_active" tabindex="0">';
$config['cur_tag_close'] = '</a>';
$config['anchor_class'] = 'class="paginate_button"';
//Customizing the "Next" Link
$config['next_link'] = 'Next';
$config['next_tag_open'] = '';
$config['next_tag_close'] = '';
//Customizing the "Previous" Link
$config['prev_link'] = 'Previous';
$config['prev_tag_open'] = '';
$config['prev_tag_close'] = '';
$this->pagination->initialize($config);
$page = ($this->uri->segment(2))? $this->uri->segment(2) : 0;
$data['pagination'] = $this->pagination->create_links();
答案 0 :(得分:0)
现在幸运的是我找到了代码修复问题, 我只改变了
$config['base_url'] = base_url() . 'blog';
到
$config['base_url'] = base_url() . $this->lang->lang() . '/blog';