[eluser]Märt[/eluser]
Paginate library is loaded correctly, because I tested it by entering offsets manually to url: blog/index/5 for example (when I'm not using create_links function).
If I use create_links() function then I get this fatal error. Everything else is working.
This is my controller that loads module:
Code:
function index()
{
$this->load->model('Blog_posts', 'blog');
echo $this->blog->load_posts();
}
This is my model:
Code:
<?php
class Blog_posts extends Model {
function Blog_posts()
{
parent::Model();
}
function load_posts()
{
$this->load->database();
$this->load->helper('url');
$this->load->library('parser');
$config['base_url'] = base_url().'blog';
$config['uri_segment'] = 3;
$config['total_rows'] = $this->db->count_all('posts');
$config['per_page'] = '5';
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$list = $this->db->get('posts',$config['per_page'],$this->uri->segment(3));
$posts_page = '';
foreach ($list->result_array() as $item)
{
$array = array(
'post_id' => $item['id'],
'post_title' => $item['post_title'],
'post_body' => $item['post_body'],
'meta' => $item['date']);
$posts_page .= $this->parser->parse('blog_post', $array, TRUE);
}
$this->load->library('pagination');
$this->pagination->initialize($config);
$page = array('posts_listing' => $posts_page,
'make_links' => $this->paginate->create_links()); //if i remove $this->paginate->create_links() then everything is working (except I do not have links)
$this->parser->parse('blog_posts_listing',$page);
}
}
Hopefully you understand what I'm trying to say.