Welcome Guest, Not a member yet? Register   Sign In
Pagination config file not loading [Solved]
#1

[eluser]Adrian Walls[/eluser]
Hi,

I have sucessfully added pagination to my application and I wanted to start to use css to style the pagination links. As this will be used in more than one place I want to put pagination configuration options into a config file so its available application wide. I have created my config/pagination.php file which looks like:

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

//$config['full_tag_open'] = '<p>';
//$config['full_tag_close'] = '</p>';

// First Links
$config['first_link'] = 'First Link';
$config['first_tag_open'] = '<li>';
$config['first_tag_close'] = '</li>';

// Last Links
$config['last_link'] = 'Last Link';
$config['last_tag_open'] = '<li>';
$config['last_tag_close'] = '</li>';

// Next Link
$config['next_link'] = '&raquo;';
$config['next_tag_open'] = '<li>';
$config['next_tag_close'] = '</li>';

// Previous Link
$config['prev_link'] = '&laquo;';
$config['prev_tag_open'] = '<li>';
$config['prev_tag_close'] = '</li>';

// Current Link
$config['cur_tag_open'] = '<li class="active">';
$config['cur_tag_close'] = '</li>';

// Digit Link
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';

/* End of file pagination.php */
/* Location: ./system/application/config/pagination.php */

and my controller looks like (NOTE: I am using Smarty for my view):

Code:
//Load models
$this->load->model('stock_model');

//Load libraries
$this->load->library('pagination');
        
//get total stock
$query_rows = $this->stock_model->get_stock_count();
        
//Setup pagination options
$limit = $this->config->item('stock_listings_per_page');
$stock_list = $this->stock_model->get_stock_list($limit, $offset);
                
$config['base_url'] = $this->config->item('base_url')."/index.php/admin/list_stock/";
$config['total_rows'] = $query_rows;
$config['per_page'] = $limit;
                    
$this->mysmarty->assign("paginateLinks", $this->pagination->create_links());            
$this->mysmarty->assign("stockList", $stock_list);

However when I use this as above the pagination links are not being created. The Pagination user manual page says that if you are using a config file then you do NOT need to initialize this using

Code:
$this->pagination->initialize($config);

as its automatically loaded for you. However my pagination links do not appear at all if I don't include this initialize in my controller.

Any ideas? All help greatly appriciated.


Messages In This Thread
Pagination config file not loading [Solved] - by El Forum - 11-10-2009, 11:21 AM
Pagination config file not loading [Solved] - by El Forum - 11-11-2009, 03:43 AM
Pagination config file not loading [Solved] - by El Forum - 11-11-2009, 10:07 AM
Pagination config file not loading [Solved] - by El Forum - 11-11-2009, 10:33 AM
Pagination config file not loading [Solved] - by El Forum - 11-11-2009, 01:35 PM
Pagination config file not loading [Solved] - by El Forum - 11-11-2009, 10:32 PM
Pagination config file not loading [Solved] - by El Forum - 11-12-2009, 03:22 AM
Pagination config file not loading [Solved] - by El Forum - 11-12-2009, 03:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB