CodeIgniter Forums

Full Version: organization of files
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

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?

El Forum

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

El Forum

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.