[eluser]clintonbeattie[/eluser]
Hi,
Pagination doesn't work. Have read a few tutorials and I think this code should be okay...
The initial page shows all the results from teh database but still shows the pagination. When I click on "2" in the pagination it brings up..
Code:
404 Page Not Found
The page you requested was not found.
Controller
Code:
function index()
{
$data['page_title'] = "Join Tables";
$data['description'] = "Blog";
$data['keywords'] = "Blog";
$config['base_url'] = base_url();
$config['total_rows'] = $this->db->count_all('posts');
$config['per_page']= 2;
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$this->pagination->initialize($config);
$data['paging_links'] = $this->pagination->create_links();
//load the model and get results
$data['blogposts'] = $this->MBlog->getAllPosts($config['per_page'],$this->uri->segment(3));
$data['main'] = 'blog';
$this->load->vars($data);
$this->load->view('template');
}
View
Code:
<?php
foreach ($blogposts as $key => $post){
echo "<h4>".$post['post_title']."</h4>";
echo "<p>".date('d M Y', strtotime($post['post_date'])) ."</p>";
echo "<p>".$post['post_intro']."</p>";
echo anchor('welcome/post/'.$post['id'],'Read More');
}
?>
<?php echo $this->pagination->create_links(); ?>