EllisLab text mark
Advanced Search
     
configuration of any file
Posted: 14 April 2012 11:06 AM   [ Ignore ]
Joined: 2010-10-18
25 posts

I created a configuration file paging (in the config folder, called paging), however, when I use $ this-> config-> load (paging) settings are not carried out, that’s the way it has to be done?

 
Posted: 14 April 2012 11:23 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2011-11-04
244 posts

More like this:

$this->config->load('paging'); 

But yeah..

 
Posted: 14 April 2012 11:27 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2010-10-18
25 posts

does not work that way, I’ve tried

 
Posted: 14 April 2012 11:29 AM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Joined: 2011-11-04
244 posts

post your config code and what you’re trying to do

 
Posted: 14 April 2012 11:38 AM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Joined: 2010-10-18
25 posts

$config[‘base_url’]  = site_url(’/profiles’);
$config[‘total_rows’] = $all_reg;
$config[‘per_page’]  = $amount_pag;

$config[‘full_tag_open’]  = ‘<ul>’;
$config[‘full_tag_close’]  = ‘</ul>’;
$config[‘prev_tag_open’]  = ‘<li id=“prev”>’;
$config[‘prev_tag_close’]  = ‘</li>’;
$config[‘next_tag_open’]  = ‘<li id=“next”>’;
$config[‘next_tag_close’]  = ‘</li>’;   
$config[‘first_tag_open’]  = ‘<li>’;
$config[‘first_tag_close’] = ‘</li>’;
$config[‘num_tag_open’]  = ‘<li>’;
$config[‘num_tag_close’]  = ‘</li>’;
$config[‘cur_tag_open’]  = ‘<li>’;
$config[‘cur_tag_close’]  = ‘
</li>’;

 
Posted: 14 April 2012 12:01 PM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Joined: 2011-11-04
244 posts

I don’t think you can do pagination like that. Because you can only fetch single items when using the config class

 
Posted: 14 April 2012 12:25 PM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Joined: 2010-10-18
25 posts

I understand, no problem, I’ll create a helper

 
Posted: 14 April 2012 04:51 PM   [ Ignore ]   [ # 7 ]   [ Rating: 0 ]
Joined: 2010-10-18
25 posts

I found the problem, the data must be passed as follows in the config file (pagination.php) within:

$config['full_tag_open']  '<div id="pag"><ul>';
$config['full_tag_close''</ul></div>';
$config['prev_tag_open']  '<li id="prev">';
$config['prev_tag_close''</li>';
$config['next_tag_open']  '<li id="next">';
$config['next_tag_close''</li>';
$config['first_link']     'Home';
$config['first_tag_open''<li>';
$config['first_tag_close']'</p> </ li>';
$config['last_link']      'Last page';
$config['last_tag_open']  '<li>';
$config['last_tag_close''</p> </ li>';
$config['num_tag_open']   '<li>';
$config['num_tag_close']  '</li>';
$config['cur_tag_open']   '<li><strong>';
$config['cur_tag_close']  '</strong></li>'

and the controller:

$this->load->library ('pagination');

$config['base_url']   $url;
$config['total_rows'$all_reg;
$config['per_page']   $amount_pag;

$config['num_links'$num_links;
$this->pagination->initialize($config); 
 
Posted: 14 April 2012 05:12 PM   [ Ignore ]   [ # 8 ]   [ Rating: 0 ]
Avatar
Joined: 2007-11-28
2435 posts

Config file names must match the library you’re loading if you want them to autoload from the config directory. Loading them through the Config class won’t do anything except make the options available through $this->config->item() or config_item().

Your solution is the right way to do it. When you load the class, it will automatically pull a config file if it finds one. Then, you can use initialize() after that to add / override any options.