Jump to content

is a template driven site in php...


tefuzz

Recommended Posts

PHP in itself is a templateing engine. No need to use a template system, when php already is one.

 

yea, my project is small so all im really looking for is how to create a function to load a header, content area, and a footer into my index page so i dont have cluttered code on the main page...is it as simeple as just throwing in a <?php include ('header.php'); ?> where I want my header to be?

PHP in itself is a templateing engine. No need to use a template system, when php already is one.

 

yea, my project is small so all im really looking for is how to create a function to load a header, content area, and a footer into my index page so i dont have cluttered code on the main page...is it as simeple as just throwing in a <?php include ('header.php'); ?> where I want my header to be?

 

Yes, though apache has ssi if this is all your planning on using php for.

Wherever you want code, just add PHP into your HTML with the opening and closing tags of course.

It's quicker and more flexible than using any template system. The only downfall is clutter in your HTML, but you can sort this out by understanding PHP syntax a little more to neaten it up a bit.

Wherever you want code, just add PHP into your HTML with the opening and closing tags of course.

It's quicker and more flexible than using any template system. The only downfall is clutter in your HTML, but you can sort this out by understanding PHP syntax a little more to neaten it up a bit.

 

I have decided this would be the best route...it's really not a template system but an ease of use system. I want to run the entire page off the index, so having the header and footer added with only 2 lines of code is a big space savings in the index.

Take a look at this topic. I posted in it regarding a "template" type layout.

 

http://www.phpfreaks.com/forums/index.php/topic,230941.msg1070233.html#msg1070233

 

I have 1 page that is my layout page. It includes all my head information (e.g. css, js ), my header, navigation, and my footer. I then call that page inside each page of my site to "wrap" around my content and have a nice "template" type of layout. When I want to change anything such as header, navigation footer etc, I do it on 1 page only. Works well. I like it and I use it every site I build anymore.

 

*note*, I saw an error in my post. I called the container page index.php, but I actually call it header.php

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.