Welcome Guest, Not a member yet? Register   Sign In
Modular separation - how to now call a helper?
#1

[eluser]tinawina[/eluser]
I can't find an answer for this in other posts re: modular separation. I just implemented modular separation which is great but now my application can't find a helper file I created. Where do I put helper files? I tried saving it to these folders -- no luck:

system/helpers

system/application/helpers

system/applications/modules/module-name/helpers

I get this error: "Unable to load the requested file: myfile.php". One thing about this is I labeled the helper I created as "myfile_helper.php" per CI's instructions but the error message only shows myfile.php. As though it doesn't know that this is a helper file. I call it into my controller's constructor like so:

$this->load->helper('myfile');

This worked pre-modular separation implementation. Any help is appreciated!

I also have a config file I created for this app. I didn't move that file at all -- just kept it in it's original place which was in a sub-folder in the config folder: system/application/config/myfolder/myconfig.php. That still works but wondering if this is the best way to go about calling this file. I call it in the constructor like this:

$this->load->config('myfolder/myconfig');

Thanks for your help!
#2

[eluser]esra[/eluser]
You will get more help if you post your message in the Modular Separation forum thread because many users subscribe to that thread, including Zawk (the author).

If you store your helpers and all other application-specific files under application/ and move application to the same level as system/, you can replace your Codeigniter files easily when new updates arrive by replacing system directory, and deleting your application/ directory after making whatever changes are mentioned in the update docs.

I use modular separation and store my module-specific helpers in application/helpers/. It is possible to store module-specific helper files under modulename/ if you overload the helper method in MY_Loader.php. Use an approach similar to loading a language file from modulename/ and add the new search paths for the current helper directory locations as well as new location for dedicated module helpers.




Theme © iAndrew 2016 - Forum software by © MyBB