PDA

View Full Version : Template Synchronization



greggumz
10 May 2009, 11:14 AM
I want to know if there is a way to synchronize your template file for your website.

That way if you wanted to change the top banner on say 10 pages that you used to template to create, could you change it by changing one file? or do you have to go change each one separately.

I use dreamweaver

Wickham
11 May 2009, 12:48 AM
The best way to include code that repeats on several pages is to use an "include" file either with SHTML or preferably PHP, then you only have to change one file, the "include" file, and it changes all the main pages.

Remove the banner code from all your pages and insert
<?php include ("header.inc"); ?>

then put the banner code in a separate file called header.inc (in the same folder/directory) - no doctype, html, head or body tags, just the banner code.

then rename all your main pages with .php filename extension instead of .html

You need to check that your host supports php and you won't see the full page with the banner on your local computer unless you download WampServer 2 which includes an Apache server because the php code has to be processed by a server, either your host's server before someone downloads the page or Apache on your computer.
See http://www.wickham43.net/serversideincludes.shtml