Library's parameters load with MAMP, but will not load when placed on server? - 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: Library's parameters load with MAMP, but will not load when placed on server? (/showthread.php?tid=17599) |
Library's parameters load with MAMP, but will not load when placed on server? - El Forum - 04-09-2009 [eluser]elvis2k[/eluser] Newbie first post. Any help is much appreciated! My custom library's parameters will not load when on a server, but load fine when using MAMP. I have written a custom library which lives in: application/libraries/MYcustom.php "MYcustom" library uses a parameter array from a config file which lives in: application/config/MYcustom.php The library's constructor: function MYcustom($params = array()){ $this->params = $params; } Reference to the library in a controller: $this->load->library('MYcustom'); $this->mycustom->doSomething(); This set-up is working fine on MAMP. But when everything is uploaded to my server, the library's parameters do not load. I'm not seeing any other errors. Library's parameters load with MAMP, but will not load when placed on server? - El Forum - 04-09-2009 [eluser]TheFuzzy0ne[/eluser] Welcome to the CodeIgniter forums! The issue is usually an issue with case-sensitivity. I don't know if Macs are case-sensitive (as it's based on Linux), but I know Linux is fussy about case. I'm also not sure about your MY prefix. Please could you give the actual file name you're using, and the contents of the file? You only need to use MY if you're overriding an existing CodeIgniter library, and even then, by default the prefix is "MY_". Library's parameters load with MAMP, but will not load when placed on server? - El Forum - 04-09-2009 [eluser]elvis2k[/eluser] Thanks for the reply. Ha, well the "MYcustom" is fake name for this post. Actual file names: application/libraries/OSUcommonContent.php application/config/OSUcommonContent.php Controller calls: $this->load->library('OSUcommonContent'); $this->osucommoncontent->helloWorld(); Library constructor: function OSUcommonContent($params = array()){ $this->params = $params; } Library's parameters load with MAMP, but will not load when placed on server? - El Forum - 04-09-2009 [eluser]TheFuzzy0ne[/eluser] I don't see where the parameters are passed in to your libraries constructor. Am I missing something? Library's parameters load with MAMP, but will not load when placed on server? - El Forum - 04-09-2009 [eluser]elvis2k[/eluser] [quote author="TheFuzzy0ne" date="1239318720"]I don't see where the parameters are passed in to your libraries constructor. Am I missing something?[/quote] I'm just doing what the guide says, and it works in MAMP: Quote: http://ellislab.com/codeigniter/user-guide/general/creating_libraries.html Inside the config file I have this: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Library's parameters load with MAMP, but will not load when placed on server? - El Forum - 04-09-2009 [eluser]TheFuzzy0ne[/eluser] [DELETED] Library's parameters load with MAMP, but will not load when placed on server? - El Forum - 04-09-2009 [eluser]TheFuzzy0ne[/eluser] I'd suggest changing your file name so that either the whole name is lowercase, or only the first letter is capitalised: ./system/libraries/Loader.php - line 860 Code: function _ci_init_class($class, $prefix = '', $config = FALSE, $object_name = NULL) This could be made a bit clearer in the docs. Please consider reporting this. Library's parameters load with MAMP, but will not load when placed on server? - El Forum - 04-09-2009 [eluser]elvis2k[/eluser] Many thanks! Renaming worked! Library and Config file names: Osucommoncontent.php Controller calls: $this->load->library(‘Osucommoncontent’); $this->osucommoncontent->helloWorld(); Library constructor: function Osucommoncontent($params = array()){ $this->params = $params; } |