• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

PHP Template Include


tim

Senior Member
#1
Hi guys,

I recently came across a pretty average idea for putting together an e-commerce site for a client.

I wanted a template (header and all that) coded in php to bring in content to a certain place in the template. The code lists the bare parts of it, like the <html> and <head>, and (optional) side bar etc, leaving main content blank so stuff can be imported into it.

If you don't know what I mean, go to TurnKey I.T Solutions - Web Design, I.T Consultancy, VoIP Telecommunications - Based in Somerset and press cmd+u - they only have the side bar links and the <head> <html> info, just pulling in different links to fit in the actual main content. But how do I make that happen without using frames? J'ai no idea.
 

Jazajay

Active Member
#3
Hay Tim.

<?php include"header.php"?>
<div>
....
</div>
<?php include"footer.php"?>

Then by making a change in either the footer or header php files changes any page using those files all at once. Think a server side CSS sheet if you will which allows (X)HTML. :)

Jaz

Key:
Purple ~ XHTML
Red ~ PHP
 

tbwcf

Active Member
#5
There ya go! - Jazajay to the rescue! - sorry I was so brief - got a bit of a misson on at work so couldn't take much time out
 

tim

Senior Member
#7
ahh didn't notice your post tbwcf, but thanks!

i've used it before, but i was looking at the opposite function, getting the header to do a php include of a file upon request.