Jump to content

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

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.