library classes |
[eluser]jaswinder_rana[/eluser]
Thanks Randy. Understood. Wasn't sure about this point.
[eluser]sipsniffa[/eluser]
Many thanks Randy and jaswinder_rana for your help. It turns out that the problems I experienced were related to the configuration option 'subclass_prefix'. I hadn't assigned any value to this variable (i.e. it was set to the empty string, '') and as a result the names of my library classes were deemed to be attempts to subclass CodeIgniter library classes (code snipped from _ci_load_class() in system/library/Loader.php): Code: $subclass = APPPATH.'libraries/'.$subdir.config_item('subclass_prefix').$class.EXT; [quote author="Randy Casburn" date="1229390515"] Here is how CI determines the file name from the load->library call: Code: // We'll test for both lowercase and capitalized versions of the file name As you can see, there is no way the something like Special_Class will work. [/quote] I don't understand why your example wouldn't work, Randy. From my reading of the code, I think that capitalisation and underscores are fine, so long as the class and file names match (both in their use of case and underscores - strangely, the first character of the class/file name is allowed to vary). I thought it worth pointing out these problems, as a forum search turned up a few other postings that appear to be related to the same issues. [edit] Submitted related post to Bug Reports forum. [/edit] Thanks again, Paul.
[eluser]sipsniffa[/eluser]
The 'subclass_prefix' configuration option takes a non-empty, default value of '_MY'. For newcomers to CI (such as me!) this is a clue that it shouldn't be assigned an empty value (see this bug report). Paul.
[eluser]Randy Casburn[/eluser]
[quote author="sipsniffa" date="1229448625"]so long as the class and file names match (both in their use of case and underscores - strangely, the first character of the class/file name is allowed to vary).[/quote] Hey Paul, yea...this wasn't always the case. I suppose this is old think on my part. I should update my thinking to the current revisions. I think it's probably been this way for a couple releases now. I'm glad you're into the code base and poking around. Sorry to have misled. Randy
[eluser]sipsniffa[/eluser]
[quote author="Randy Casburn" date="1229461366"][quote author="sipsniffa" date="1229448625"] Sorry to have misled. [/quote] Not at all, Randy. I'm very grateful for the time and suggestions you (and jaswinder_rana) gave. We've all increased our understanding of CI!! Cheers, Paul. |
Welcome Guest, Not a member yet? Register Sign In |