Table of Contents
This section is aimed at PHP developers and explains how to use and customize PHPTAL behaviours for simple and advanced usage.
Defines: list of PHPTAL defines and defines influencing PHPTAL
PHPTAL: the main PHPTAL class
PHPTAL_Filter : filtering template sources and PHPTAL output
PHPTAL_Trigger: creating triggers for phptal:id
PHPTAL_TranslationService: replacing the builtin gettext support with your own internationalization system
After the inclusion of PHPTAL library, some defines will be created in PHP context, all these defines come from PHPTAL.php file:
PHPTAL_VERSION: version of PHPTAL library installed on your system (in format: X.X.X)
PHPTAL_PHP_CODE_DESTINATION: this is the path where intermediate PHP files produced by PHPTAL will be stored. This define may be overwritten before the inclusion of PHPTAL.php, the specified path must contain the leading path separator.
You can configure some PHPTAL features by defining some constants:
To tell PHPTAL to ignore intermediate php files and to reparse templates every time:
<?php
define('PHPTAL_FORCE_REPARSE', 1);
require_once 'PHPTAL.php';
?>
To tell PHPTAL to store its intermediate PHP files other than in the '/tmp/' directory:
<?php
define('PHPTAL_PHP_CODE_DESTINATION', '/path/to/somewhere/');
require_once 'PHPTAL.php';
?>
If all your files are stored in a base directory (repository), you can define PHPTAL_TEMPLATE_REPOSITORY as follows:
<?php
define('PHPTAL_TEMPLATE_REPOSITORY', '/path/to/templates/root');
require_once 'PHPTAL.php';
?>
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.