PHP Classes

PHP Custom Tags: Template engine based on tags similar to HTML

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 313 All time: 7,286 This week: 62Up
Version License PHP version Categories
custom-tags 10BSD License5.1HTML, PHP 5, Templates
Description 

Author

This class implements a template engine based on tags similar to HTML.

It can capture and process the current script output as a template that may have tags similar to HTML.

The supported tags behavior is defined according to the presence of directories with the same name of the tag inside a given tag directory.

Each tag directory can contain templates and scripts that define how each tag should be processed.

Picture of Oliver Lillie
  Performance   Level  
Innovation award
Innovation award
Nominee: 2x

Winner: 1x

 

Details

#PHP CustomTags Allows you to create HTML custom tags that aids in templating and providing easy to use extendable functionality that designers find easy to work with. Create completely customisable tags and even comes with a simple internal templating engine. Tags can also be collected and processed in bulk, which can be usefull when optimising performance of database queries and other such junk. ##An Example Custom Tag. ```html <ct:inline some="attribute"> This is an in line template. <br /> This is a #{tag} that can be accessed by the callback function </ct:inline>` ``` ##Simple Integrated Example ```php <?php $current_dir = dirname(__FILE__).DIRECTORY_SEPARATOR; require_once dirname($current_dir).DIRECTORY_SEPARATOR.'customtags.php'; $ct = new CustomTags(array( 'parse_on_shutdown' => true, 'tag_directory' => $current_dir.'tags'.DIRECTORY_SEPARATOR, 'sniff_for_buried_tags' => true )); ?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>untitled</title> <meta name="generator" content="TextMate http://macromates.com/"> <meta name="author" content="Oliver Lillie"> <!-- Date: 2010-07-10 --> </head> <body> <ct:youtube id="wfI0Z6YJhL0" /> </body> </html> ``` **Inside the related tag file; tags/youtube/tag.php:** ```php <?php function ct_youtube($tag) { return '<object id="'.$tag['attributes']->id.'" value="http://www.youtube.com/v/'.$tag['attributes']->id.'" /><param ...etc...>'; } ```` **Resulting output:** ```html <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>untitled</title> <meta name="generator" content="TextMate http://macromates.com/"> <meta name="author" content="Oliver Lillie"> <!-- Date: 2010-07-10 --> </head> <body> <object id="wfI0Z6YJhL0" value="http://www.youtube.com/v/wfI0Z6YJhL0" /><param ...etc...> </body> </html> ```

  Files folder image Files (137)  
File Role Description
Files folder imageexamples (5 files, 1 directory)
Files folder imagelib (1 directory)
Accessible without login Plain text file autoloader.php Aux. .
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file composer.json Data .
Accessible without login Plain text file LICENSE.md Lic. Auxiliary data
Accessible without login Plain text file README.md Doc. Auxiliary data

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:313
This week:0
All time:7,286
This week:62Up