Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

PHPTAL_Filter Class Reference

Inheritance diagram for PHPTAL_Filter:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 filter (&$tpl, $data, $mode)

Detailed Description

Interface for source filter.

This interface may be used to implement input / output filters.

If the template intermediate php code is up to date, pre filters won't be used on it.

Output filters are only called on main template result.

<? class MyFilter extends PHPTAL_Filter { function filter(&$tpl, $data, $mode) { // just to present $mode usage for input/output filters if ($mode == PHPTAL_POST_FILTER) { return PEAR::raiseError("MyFilter mustn't be used as a pre-filter'); }

// remove html comments from template source return preg_replace('/(<\!--.*?-->)/sm', '', $data); } }

$tpl = PHPTAL('mytemplate.html'); $tpl->addInputFilter( new MyFilter() ); echo $tpl->execute();

?>

Author:
Laurent Bedubourg <laurent.bedubourg@free.fr>

Definition at line 40 of file Filter.php.


Member Function Documentation

PHPTAL_Filter::filter &$  tpl,
data,
mode
 

Filter some template source string.

Parameters:
PHPTAL_Template $tpl The template which invoked this filter.
string $data Data to filter.
int $mode PHPTAL_PRE_FILTER | PHPTAL_POST_FILTER depending if this filter is registered as a pre-filter or as a post-filter.

Definition at line 56 of file Filter.php.

References filter().

Referenced by filter().


The documentation for this class was generated from the following file:
Generated on Tue Jun 29 23:40:58 2004 for Mediawiki by doxygen 1.3.7