![]() |
where can i put my own function - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: where can i put my own function (/showthread.php?tid=12748) |
where can i put my own function - El Forum - 10-30-2008 [eluser]syntaxerror[/eluser] hi, can anyone please help me. i have my own function that makes an array to lower case (strtolower) because php has no built in function to convert array to lower case i make my own function. my question is where should i put this function in code igniter? model?view? or controller? BTW my script is Code: function arraytolower($array,$round = 0){ thanks where can i put my own function - El Forum - 10-30-2008 [eluser]OES[/eluser] Create a new library for this type of thing. Ie Common. Then within yout controller load it like any other. $this->load->library('common'); Then to use it ie. $this->common->arraytolower($array,$round) Hope this helps. where can i put my own function - El Forum - 10-30-2008 [eluser]Sarfaraz Momin[/eluser] Well if there is just a single function related to it I would go about creating a helper. Code: //load helper Have a good day !!! where can i put my own function - El Forum - 10-30-2008 [eluser]syntaxerror[/eluser] i add it in the array_helper, and load it. and use the function, well, it seems working. thanks |