Config variable only returning first letter? |
[eluser]joehopkins[/eluser]
Hi, I'm setting a variable to be used globally across the site so I thought I'd load a config file: config/Sitevariables.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); config/autoload.php Code: $autoload['config'] = array('email', 'Sitevariables'); anything.php Code: echo $this->config->item('Sitevariables', 'site_name') Returns 'B'. Just the first letter. What is going on?!!!! Why doth CodeIgniter forsake me so? Thanks, Joe
[eluser]JonoB[/eluser]
Please read http://ellislab.com/codeigniter/user-gui...onfig.html carefully. You have Code: echo $this->config->item('Sitevariables', 'site_name') I am also note sure if autoloading the config creates the config as a separate array. You may have to load it manually instead Code: $this->config->load('Sitevariables', TRUE); Lastly, I'd suggest lowercase everything/
[eluser]InsiteFX[/eluser]
If it uses $config[] it will load! Code: $this->config->load('Sitevariables'); InsiteFX
[eluser]joehopkins[/eluser]
Thanks Guys, JonoB - that didn't work for some reason, but I have lowercased it!!!! ![]() InsiteFX - that did work (kudos): I don't need Code: $this->config->load['etc']; so just Code: $this->config->item('site_name'); works, as long as I have Code: $autoload['config'] = array('sitevariables', 'etc.'); In the autoload.php file. ( JonoB - note the lower case ![]() It seems the answer was more simple than I thought. I still wonder why it was only outputting the first letter, but it doesn't matter any more. Many thanks guys! You'll both go to Heaven. Joe |
Welcome Guest, Not a member yet? Register Sign In |