Going to try and explain this the best I can, so please bear with me.
Ive got my site's layout saved as index.php Its the layout I want for my site, just minus the content in the bottom right corner where its supposed to be placed. Quite simply, I just wanted to be able to make content for my site, do an include so my layout is included with it, that way I only have to update one layout index.php file and the layouts for all the pages will be updated automatically. Guess my question is, how can I go about doing this? I know what I want to do, just not sure how to implement it.
Including Files (For Web layout)
Moderator: General Moderators
-
Silent-Chaos
- Forum Newbie
- Posts: 6
- Joined: Tue Oct 22, 2002 10:58 am
You are going to need to use templates. HTML files which contain the layout with keywords which are replaced by a "template parser". For example,
header.html
footer.html
How good is your PHP / HTML? I find the best way to learn new techniques is to have a small working example. Download phpChat (http://www.phpwizard.net/projects/phpChat/) and have a look at the source code. There are enough pages to get the basic idea, but not too many so as to confuse you and scare you away! You won't need to get it working to see how it works! Good luck.
header.html
Code: Select all
<html>
<head>
<title>{TITLE}</title>
</head>
<body>Code: Select all
</body>
</html>Code: Select all
<?php
include("header.html");
//content
include("footer.html");
?>