[eluser]DustinH[/eluser]
I've been trying everything to get this pagination system to work, but everytime it comes up with a blank page, NOTHING is showing up and I've run outa options, can anyone see something that I cant?
Controller
Code:
<?php
session_start();
class Page extends Controller {
function Page()
{
parent::Controller();
$this->load->helper('url');
$this->load->helper('form');
}
function index()
{
}
function view()
{
$this->load->library('pagination');
$this->load->model('Blog_model');
$per_page = 10;
$total = $this->posts_model->count_posts();
$data['blogs'] = $this->posts_model->get_posts($per_page, $this->uri->segment(3));
$base_url = site_url('page/view');
$config['base_url'] = $base_url;
$config['total_rows'] = $total;
$config['per_page'] = $per_page;
$config['uri_segment'] = '3';
$this->pagination->initialize($config);
$this->load->view('page_view', $data);
}
}
?>
Model
Code:
<?php
class Blog_model extends Model {
function Blog_model()
{
parent::Model();
}
function get_posts($limit = NULL, $offset = NULL)
{
$this->db->limit($limit, $offset);
return $this->db->get('Blogs');
}
function count_posts()
{
return $this->db->count_all_results('Blogs');
}
}
?>
View
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
Blog Posts
<br />
<?php
foreach ($blogs->results() as $blog):
echo $blog->Title, '
';
echo $blog->Body_content;
endforeach;
echo $this->pagination->create_links();
?>
</body>
</html>
Any help would be greatly appreciated guys, I'm at my wits end.