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

[eluser]web_developer[/eluser]
Hello,

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?
#2

[eluser]saidai jagan[/eluser]
simply load that library and use it
$this->load->library('your_library');
$this->your_library->your_function();
#3

[eluser]imn.codeartist[/eluser]
Better create a helper file using _helper suffix and place it in the helper folder

which is system/application/yourfile_helper.php
#4

[eluser]CroNiX[/eluser]
Yes if its straight functions load as a helper as dixcoder suggests. If its a class load it as a library.
#5

[eluser]mjsilva[/eluser]
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.
Code:
$autoload['helper'] = ('my_functions_helper');

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

[eluser]kakawett[/eluser]
That helped me too, thanks




Theme © iAndrew 2016 - Forum software by © MyBB