Php – Codeigniter: user defined helper function does not load

codeignitercodeigniter-classloadercodeigniter-helpersPHP

I made a custom helper extending the system string_helper.php.

I placed it in my /application/helpers directory, called it MY_string_helper.php as required, unit-tested its functions.

Now, when I try to call one of its functions from a model, it does not work.

The functions in the default string helper work, instead. It looks like my extension is not loaded for some reasons.

Thanks a lot, and happy holidays.


Edit: even funnier. I saved the file as categories_helper.php in the system/helpers directory, and when I try to load it within a model i got the following response: *Unable to load the requested file: helpers/categories_helper.php*

Best Answer

I had the same problem. I came from windows OS development of my codeigniter project, then shifted to Ubuntu, but somehow it still didn't load my helpers.

I found that changing the naming convention to lowercase solves the problem. Don't follow what's written in the doc where you are given a prefix to insert, especially if it's in uppercase. Make use of lowercase.

Related Topic