PHP Classes

Template Handler: Template handler class to separate HTML from code

Recommend this page to a friend!
  Info   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 41%Total: 1,563 This week: 1All time: 2,523 This week: 560Up
Version License Categories
template_handler 1.0.0Freely DistributableTemplates
Description 

Author

The template handler class is an efficient way of separating HTML from your PHP code.

This class works on a simple bases of setting template "objects" that are contained within the template file. For instance:

Within a template, define an object this way: {content} .

Then, use $template->setObject('content',$content); to replace the {content} tag with the $content variable.

Objects can be set multiple times within the same script with each "setObject" content appending to the previous. Additionally, the template can also contain PHP code, and this will be correctly evaluated and displayed.

For more detailed explantaion view README.TXT file.

Picture of Rob Thomson
Name: Rob Thomson <contact>
Classes: 1 package by
Country: United Kingdom
Age: ???
All time rank: 180080 in United Kingdom
Week rank: 411 Up12 in United Kingdom Up

Details

################################################# Template Handler Class ################################################# The template_handler class is a simple class designed to assist the developer in wring PHP code, without all the issues related to embeding HTML in the code. The class works on a simple principle. - Create an HTML page, and wherever you want dynamic content to be inserted on the page insert a 'tag' i.e: {content} - Using the template handler, open the template, and set the objects - display the template ======================================= sample code ======================================= <? # load the new template template $template = new template_handler(); $template->setBaseDir("templates/"); $template->setTemplate("template.htm"); $template->setObject('content','This is the content'); print $template->Retrieve(); ?> =================================== sample template =================================== <html> <body> <hr> {content} </body> </html> -

  Files folder image Files  
File Role Description
Accessible without login Plain text file README.TXT Doc. Readme File
Plain text file template_handler.php Class Main Class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,563
This week:1
All time:2,523
This week:560Up
User Ratings User Comments (1)
 All time
Utility:58%StarStarStar
Consistency:66%StarStarStarStar
Documentation:52%StarStarStar
Examples:-
Tests:-
Videos:-
Overall:41%StarStarStar
Rank:3680