Login   Register  
PHP Classes
elePHPant
Icontem

File: doc/Plugins.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Daniel Andres Marjos  >  Extensible Template  >  doc/Plugins.txt  >  Download  
File: doc/Plugins.txt
Role: Documentation
Content type: text/plain
Description: Plugin system documentation
Class: Extensible Template
Template engine extensible using sub-classes
Author: By
Last change:
Date: 6 years ago
Size: 1,593 bytes
 

Contents

Class file image Download
Plugins are a mechanism intended to extend any system without digging into the original source code
and without worrying about losing your own code when upgrading. With this in mind, although you can extend the class
and add your own tags that way, I've implemented a plugins mechanism to make further more extensible the 
template engine. 

The basis.

A plugin class can be created for each of the three identifiers types recognized by the engine, such as block tags, simple tags
or special functions. Of course, you must follow a few rules about naming conventions:

Block tags (such as <table></table> or <form></form>) must be defined in a class named ** bltag.tagname.php **
in your plugin directory and this file MUST define a class named ** block_tag_tagname **

Simple tags (such as <input /> or <img />) must be defined in a class named ** tag.tagname.php **
in your plugin directory and this file MUST define a class named ** simple_tag_tagname **

Special functions (sorry, there is no such thing in standard HTML) must be defined in a class named ** function.funcname.php **
in your plugin directory and this file MUST define a class named ** special_function_funcname **

It's recommended that your class extends ExtTpl_Block_Api, ExtTpl_Simple_Api or ExtTpl_Function_Api depending on your class
type (you can look at bltag.recordset.php sample on how to do this).

You can code your tag/function class in any way you want to. The only method you should override is Process, as this is the 
method called by the engine to process your tag, and should return the HTML code to use.