Welcome Guest, Not a member yet? Register   Sign In
I have my own Function file. How can i use that?


I have my own function file, I would like to use in Model, View and Controller (anywhere)
How can I use that functions? (I have put that function file in library directory)

But now how can I access my functions in Model, Controller and in View?

[eluser]saidai jagan[/eluser]
simply load that library and use it

Better create a helper file using _helper suffix and place it in the helper folder

which is system/application/yourfile_helper.php

Yes if its straight functions load as a helper as dixcoder suggests. If its a class load it as a library.

Imaging that your file is called my_functions.php

1) place it in application/helpers rename it my_functions_helper.php
2) go to autoload.php under application/config, and auto-load it by adding your helper name to $autoload['helper'] array.
$autoload['helper'] = ('my_functions_helper');

And that's it, after doing this you can call your function everywhere.

That helped me too, thanks

Theme © iAndrew 2016 - Forum software by © MyBB