![]() |
Config variable only returning first letter? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Config variable only returning first letter? (/showthread.php?tid=44186) |
Config variable only returning first letter? - El Forum - 08-06-2011 [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 Config variable only returning first letter? - El Forum - 08-06-2011 [eluser]JonoB[/eluser] Please read http://ellislab.com/codeigniter/user-guide/libraries/config.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/ Config variable only returning first letter? - El Forum - 08-06-2011 [eluser]InsiteFX[/eluser] If it uses $config[] it will load! Code: $this->config->load('Sitevariables'); InsiteFX Config variable only returning first letter? - El Forum - 08-08-2011 [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 |