Welcome Guest, Not a member yet? Register   Sign In
general functions (non-class specific)
#1

[eluser]richthegeek[/eluser]
Hi,

How do I create general functions - or rather, where do I put them? Is there a file that I can put them in or do I have to put it in the form of a helper?
#2

[eluser]richthegeek[/eluser]
ok, just looked at the existing helpers - they seem to fulfill my needs entirely.

For those that looked at this looking for the answer (rather than to answer it):

- for general functions create a file in the "system/helpers" directory. They follow the format "name_helper.php", so for "general", call it "general_helper.php"

- just put them in standard function format - nothing fancy

- load them by editing the "autoload.php" config file, changing helper list to include the name of your helper.

- and your done.
#3

[eluser]webthink[/eluser]
Or if you don't need them loaded on every request
$this->load->helper('general_helper');
#4

[eluser]Derek Allard[/eluser]
Ah, thanks for writing back with a solution. So often I see "help me" and then "nevermind, I got it", and of course that doesn't help out future searchers Wink

Just to add this this, could can also add your specific helpers into application/helpers/ if you wanted to, may make upgrading easier, depending on how you do it, but there is no technical advantages to this if you have only 1 app running off CI.




Theme © iAndrew 2016 - Forum software by © MyBB