PHPTAL tries to use best defaults possible and you shouldn't need to change any of the settings.
All of these are methods of the
set methods return instance of their class, so you can chain them:
<?php echo $phptal->setPhpCodeDestination('/tmp/phptal')->setOutputMode(PHPTAL::XML)->setTemplate('tpl.zpt')->execute(); ?>
то же самое, что и:
<?php $phptal->setPhpCodeDestination('/tmp/phptal'); $phptal->setOutputMode(PHPTAL::XML); $phptal->setTemplate('tpl.zpt'); echo $phptal->execute(); ?>
setEncoding(: Specify what encoding your templates use. The default is UTF-8.
setOutputMode(: If given
PHPTAL::XHTML (the default), will output elements like
<link>, and attribtes like
selected according to XHTML specification, including HTML compatibility guidelines. Use
PHPTAL::XML if you want to output other XML formats, like Atom or RSS.
setTemplateRepository(: Specifies where to look for templates. If given a string, it adds it to the list of paths searched. If given array, it replaces the list.
This doesn't mean all your files need to be in the root directory, you can use sub folders to organize your template designer's work. It's just a shortcut which will allow you to reference templates without specifying the real path, but instead their relative path within the repository.
setPhpCodeExtension(: What filename extension should be used for intermediate PHP files. The default is
php and frankly, there's no reason to change it.
setCacheLifetime(: Maximum number of days intermediate files and fragments cached with
phptal:cache should be kept.
setForceReparse(: forces reparsing of all templates all the time. This slows down PHPTAL very much, it should be used only for testing and debugging. Never enable this on production servers.
There are other
set methods for filters, internationalization, etc. They have been described in other sections of this manual.