February 15, 2002, Newsletter Issue #13: Using Templates

Tip of the Week

By now Iīm sure youīve realized the time saving value of creating a single document (or possibly 2-3 slightly different documents) with which you can create a visually consistent website. Now Iīll tell you about some ways that will make updating your site using the templates you created a simple task.


The most time consuming and tedious way to update your website from templates is to start with your blank template, add the unique content, "save as"* your new page name, and repeat this process until your site is complete or you call your hosting company begging for SSI and/or CGI support for your site. *NOTE: Be sure that you choose "save as" and NOT "save" ("save" will overwrite your blank template!)


A better way is by using CGI scripts. If you canīt write CGI scripts yourself, odds are that you can find a similar script for free. CGI (Common Gateway Interface) will provide a somewhat dynamic solution to updating your site. As an example, letīs take a directory style link site (like Yahoo). All the site listings are stored in a database. On the template, code is written to display all listings in the database. Now when the cgi script is told to "build", it creates however many pages are needed to display all the sites in the database, based on your template. Any modifications to the database (add sites, delete sites, etc...) will not show up to the surfer until the script is told to "build" again.


By far the most efficient means of updating content, if your web host supports it, is via SSI (Server Side Includes). Using SSI, you may include in your web page the contents of a file or the output of a script. Use our example template (a header and footer and changeable content in the middle; letīs "cut" the header out of the document and "paste" and save it to a new document called "header.txt". Now, if we put the code into our template where we want the header to appear, the server will include the contents of "header.txt" before sending the page to a browser. Now, every page created that contains the SSI Code will display the exact same header. If you want to make a change to the header of every page on your 800 page site, all you need to modify is "header.txt".

About LifeTips

Now one of the top on-line publishers in the world, LifeTips offers tips to millions of monthly visitors. Our mission mission is to make your life smarter, better, faster and wiser. Expert writers earn dough for what they know. And exclusive sponsors in each niche topic help us make-it-all happen.

Not finding the advice and tips you need on this Html Tip Site? Request a Tip Now!


Guru Spotlight
Jolyn Wells-Moran