CodeIgniter Forums
saving custom functions - 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: saving custom functions (/showthread.php?tid=37085)



saving custom functions - El Forum - 12-27-2010

[eluser]emrah[/eluser]
I have some database unrelated functions which I access frequently.
So I need a advice to place them in the codeigniter libray.

Model directory is for database related functions. So I think it is a bad choice for locating database unrelated functions.

libraries, helpers or another..
which directory is the best for MVC structure.


thanks...


saving custom functions - El Forum - 12-27-2010

[eluser]Madmartigan1[/eluser]
[quote author="emrah" date="1293486357"]I have some database unrelated functions which I access frequently.
So I need a advice to place them in the codeigniter libray.

Model directory is for database related functions. So I think it is a bad choice for locating database unrelated functions.

libraries, helpers or another..
which directory is the best for MVC structure.


thanks...[/quote]

Group related functions into a library, anything left over can simply go into a helper.


saving custom functions - El Forum - 12-27-2010

[eluser]emrah[/eluser]
with 'group related' what you mean?


saving custom functions - El Forum - 12-27-2010

[eluser]Madmartigan1[/eluser]
"Group" as a verb and "related" as an adjective. It DOES sound confusing what I said so here's another version:

Take all your functions that are directly related to each other, and put them in a library.
Put the rest of your functions in helper files.

Smile


saving custom functions - El Forum - 12-27-2010

[eluser]emrah[/eluser]
Now I got it clearly.
My functions are on their way to helpers.

Smile

And also thanks for the grammar Wink