I just returned from the
LinuxTag, where
John Coggeshall did a session on his
tidy extension which enables you to clean up your HMTL documents with three lines of code.
John showcased an
output filter for
Smarty (and outed himself as a Smarty fan), so I decided that patTemplate should get one, too.
So if you are using the latest patTemplate version from CVS, you may tidy up our pages before they are sent to the browser with the following lines of code:
$tmpl = &new patTemplate();
$tmpl->setRoot( 'templates' );
$options = array(
'output-xhtml' => true,
'clean' => true
);
$tmpl->applyOutputFilter( 'Tidy', $options );
$tmpl->readTemplatesFromInput( 'example_filter_output_tidy.tmpl' );
$tmpl->displayParsedTemplate();
?>
If you are using PHP4, you will need to install ext/tidy first.
Thanks to John for this great extension to PHP.