to LooselyCoupled.com homepage
 
 Weekly emails: how to advanced search
 Glossary lookup:

 

> how to > AppSwitching diary


Wednesday, June 05, 2002

Page template skins with PHP

The same template framework I used with SSI last week works just as well with PHP, which is the obvious choice for use on this part of the site, which already uses PHP for the function pages.

Since I'd already created the include files last week, I only had to make a few edits before they were ready to use here (some of the paths are different because this part of the site is hosted with Hostcentric, whereas the rest of the site is with Jumpline). The final step was to remove the template items from my original files and replace them with the include statements, which are only slightly different in PHP than from SSI. However I found I had to provide a full path statement this time, as you can see below. I don't think that's necessarily a PHP thing — it's probably because Hostcentric has set up the server differently. So this is what the include statement looks like (for security reasons I've put [accountID] instead of my actual account number):

<?php include ("/data/web/[accountID]/www/img/skin_a.txt"); ?>
Includes not only save you the trouble of editing every single page when you make changes to your template design. They also save you having to scroll through acres of page furniture before you get to the actual content of each page. That's especially valuable if you've coded functionality into the page, as it will save time when making changes or creating new pages.

Of course, you can also use includes to incorporate chunks of PHP code that are the same across multiple pages, which is a feature I've started using in some new pages that are currently under development.

posted by Phil 2:44 AM (GMT) | comments | link

Building a website using plug-in online services: the Loosely Coupled experience

read an RSS feed from this weblog

current


archives

Loosely Coupled weblog RSS source


 
 


Copyright © 2002-2006, Procullux Media Ltd. All Rights Reserved.