CodeIgniter Forums
Site level settings - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Site level settings (/showthread.php?tid=58483)



Site level settings - El Forum - 06-14-2013

[eluser]sureshls[/eluser]
Hi,

We are doing ecom based. So we need to setup the few configurations like display the product per page, search settings (on/ off), country & currency settings. How to do that?

Thanks


Site level settings - El Forum - 06-15-2013

[eluser]Pert[/eluser]
You can set up your own custom configuration file and autoload it. More details here:

http://ellislab.com/codeigniter/user-guide/libraries/config.html


Site level settings - El Forum - 06-18-2013

[eluser]sureshls[/eluser]
Thanks Pert,

You mean, $config['search_visibility'] = 'TRUE' //on

In header view,

if($config['search_visibility'])
echo <div>&lt;input type="text"&gt;&lt;/div>

is it correct? Whether i will able to access the settings through view


Site level settings - El Forum - 06-18-2013

[eluser]Pert[/eluser]
Kind of, yes.

You will be able to do this in your view files:

Code:
&lt;? if ($this->config->item('search_visibility')) : ?&gt;
   &lt;input type="text"&gt;
&lt;? endif ?&gt;



Site level settings - El Forum - 06-18-2013

[eluser]boltsabre[/eluser]
Another option would be to do it in a MY_Controller, and use $this->load->vars(), then you can also access them in your views.

That's where I check/set a users "logged_in" status so I can show the correct login/logout box.

But for what you're talking about it may make more semantic sense to do it in a config file.