CodeIgniter Forums
configuration of any file - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: configuration of any file (/thread-50941.html)



configuration of any file - El Forum - 04-14-2012

[eluser]Rodrigo Alexandre[/eluser]
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?


configuration of any file - El Forum - 04-14-2012

[eluser]Samus[/eluser]
More like this:

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

But yeah..


configuration of any file - El Forum - 04-14-2012

[eluser]Rodrigo Alexandre[/eluser]
does not work that way, I've tried


configuration of any file - El Forum - 04-14-2012

[eluser]Samus[/eluser]
post your config code and what you're trying to do


configuration of any file - El Forum - 04-14-2012

[eluser]Rodrigo Alexandre[/eluser]
$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><strong>';
$config['cur_tag_close'] = '</strong></li>';


configuration of any file - El Forum - 04-14-2012

[eluser]Samus[/eluser]
I don't think you can do pagination like that. Because you can only fetch single items when using the config class


configuration of any file - El Forum - 04-14-2012

[eluser]Rodrigo Alexandre[/eluser]
I understand, no problem, I'll create a helper


configuration of any file - El Forum - 04-14-2012

[eluser]Rodrigo Alexandre[/eluser]
I found the problem, the data must be passed as follows in the config file (pagination.php) within:

Code:
$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:

Code:
$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);



configuration of any file - El Forum - 04-14-2012

[eluser]Aken[/eluser]
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.