CodeIgniter Forums
organization of files - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived General Discussion (
+--- Thread: organization of files (/thread-26183.html)

organization of files - El Forum - 01-07-2010

I'm trying to set this up as 'best practice' as i can.

I have my controllers and view files that are working but i want to have a file in which i include in all of my views. In this include file i want to hold a function that will just echo my header.

This way i can just type the header code once(in the include file) and then include it in all of my views and then just call my function that echos out my header.

My question is..where should i put this include file? Is it a model? or do i put in my view folder because it is something i will be viewing?

organization of files - El Forum - 01-07-2010

Also, i have a function that creates a snippet from text. Where should this function go?

organization of files - El Forum - 01-07-2010

Why don't you just create a 'header' view?

You can read about it in the user guide here

There is a section called "Loading multiple views".

As for your functions, if they wouldn't fall nicely into a class, and are left to themselves, then the best place for them would be in a helper. If they would fall nicely into a class, then a library would be your best bet.