Home arrow PHP arrow Page 9 - Web Development With PHP FastTemplate

A Rose By Any Other Name... - PHP

Typically, most PHP-based Web sites use scripts which containintermingled PHP and HTML code. While this speeds up development, it alsohas a downside: an interface designer cannot modify page layouts or HTMLtemplates without the assistance of an experienced PHP developer. Well,there's a solution to the problem - and you'll be surprised to hear thatit's been around for quite a while. Say hello to PHP FastTemplate.

TABLE OF CONTENTS:
  1. Web Development With PHP FastTemplate
  2. Who Am I?
  3. Proofing The Pudding
  4. You've Got Mail
  5. Repeat Customers
  6. Flavour Of The Month
  7. A Strict() Master
  8. Musical Chairs
  9. A Rose By Any Other Name...
By: icarus, (c) Melonfire
Rating: starstarstarstarstar / 9
September 05, 2001

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
So that's one look - but now how about changing it so that the quick link boxes appear in a column on the left, with the main story taking up the rest of the page?

With FastTemplate, altering the layout is a snap - it merely involves editing the "main.tpl" and "list.tpl" templates.

<!-- begin: main.tpl --> <html> <head> <basefont face="Verdana"> </head> <body link="Navy" vlink="Navy" alink="Navy"> <!-- standard header --> <table width="100%"> <tr> <td bgcolor=navy height=50> </td> </tr> </table> <table width="100%" border="0" cellspacing="10" cellpadding="10"> <tr> <td valign=top> {LINKS} </td> <td valign=top> {ARTICLE} </td> </tr> </table> <!-- standard footer --> <hr> <center><font size=-2>All content copyright and proprietary Melonfire, 2001. All rights reserved.</font></center> </body> </html> <!-- end: main.tpl --> <!-- begin: list.tpl --> <table border=1 cellspacing=0 cellpadding=5> <tr><td align=center bgcolor="black"> <font color=white><b>{SECTION_TITLE}</b></font> </td></tr> <tr><td> <ul> {LIST} </ul> </td></tr> </table> <p> <!-- end: list.tpl -->
In this case, I've simply set up a new table structure for the main page to accommodate the new layout. And when I run the PHP script (without changing a single line of code), here's what I get:



Why stop there? Let's do away with the link boxes altogether, and have the links appear in neat rows at the bottom…

<!-- begin: main.tpl --> <html> <head> <basefont face="Verdana"> </head> <body link="Navy" vlink="Navy" alink="Navy"> <!-- standard header --> <table width="100%"> <tr> <td bgcolor=navy height=50> </td> </tr> </table> <p> {ARTICLE} <p> {LINKS} <!-- standard footer --> <hr> <center><font size=-2>All content copyright and proprietary Melonfire, 2001. All rights reserved.</font></center> </body> </html> <!-- end: main.tpl --> <!-- begin: list.tpl --> <font size=-1> New in <b>{SECTION_TITLE}</b>... <br> {LIST} </font> <p> <!-- end: list.tpl --> <!-- begin: listitem.tpl --> <a href="story.php?id={ID}"><font size=-1>{ITEM}</font></a>     <!-- end: listitem.tpl -->
In this case, I've altered three of the templates to remove the tables and list constructs, so that I'm left with a very simple and elegant layout.



As you can see, FastTemplate makes it possible to separate the user interface from the program logic, thereby allowing designers with little or no programming knowledge to alter Web pages quickly and easily. Further - with its ability to nest and repeat chunks of HTML code, it can speed up development time significantly, and also reduce the effort involved in maintaining and modifying a Web application.

That's about it from me. In case you're looking for more information, you should consider visiting the following links:

The FastTemplate home page: http://www.thewebmasters.net/

PHPBuilder's FastTemplate tutorial: http://www.phpbuilder.com/columns/sascha19990316.php3

The original (Perl) FastTemplate module: http://www.sober.com/

Till next time...stay healthy!

 
 
>>> More PHP Articles          >>> More By icarus, (c) Melonfire
 

blog comments powered by Disqus
   

PHP ARTICLES

- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 9 - Follow our Sitemap

Dev Shed Tutorial Topics: