Welcome Guest, Not a member yet? Register   Sign In
best way to add a global design?
#1

[eluser]Unknown[/eluser]
im looking for a way to add a unqiue design to my views without putting the html code into all view files.

i thought about a header.php and a footer.php that every view includes
but i think that is pretty primitve for a php framework.

How do you add a design to your CI projects?

p.s.: sry if i wasn't able to find a similiar topic, if it already exists. Smile
#2

[eluser]davidbehler[/eluser]
I usually have an index.php as view file that holds all (header, footer, nav and so) of my html but the content and then I include a content view file depending on the controller/function that's currently active. Actually the function sets a variable that holds the name of the content file.
#3

[eluser]rogierb[/eluser]
I use a template view file which holds the entire design, css and so one.
In that file I have variables like $title, $header, $meta, $content footer and many more.

On the end of each method I load that viewfile and parse the variables. To make sure I got all of them, I use a helper function to preload the all the variables and fill them with initial values/content.

Now I can parse anything I need to the template by filling the variables with for instance another view.
#4

[eluser]ZenCoding[/eluser]
I usually have a lib that I take along to every project. I have a partial views dir that have top.php, header.php, bottom.php, footer.php and nav.php. Then I have a method called plotpage that receives a 6th partial. something like $this->worker->plotpage('login');

This will get my login.php page and wraps the design around it. I like to keep things separated. It's easyer to use code in new projects this way.

This is my solution Smile




Theme © iAndrew 2016 - Forum software by © MyBB