<code lang="xml"> <?xml version="1.0"?> <html> <head> <title tal:content="title"> place for the page title </title> </head> <body> <h1 tal:content="title">sample title0</h1> <span tal:repeat="item link"> <a href="http://www.foo.com" title="some foo link" tal:attributes="href item/href; title item/title" tal:content="item/text">sample text</a><br /> </span> </body> </html> </code>
Źródło skryptu: (index.php)
<code lang="php"> <?php $old_path = ini_get('include_path'); // dla windows trzeba użyć ';' zamaist ':' w lini poniżej ini_set('include_path', $old_path.':/path/to/lib/with/PHPTAL-1.1.7');
// katalog dla plików skompilowanych define('PHPTAL_PHP_CODE_DESTINATION', '/path/to/folder/_compile/'); // wymuś kompilację za każdym razem define('PHPTAL_FORCE_REPARSE', 1); // katalog z szablonami define('PHPTAL_TEMPLATE_REPOSITORY', '/path/to/folder/_tpl/');
require_once 'PHPTAL.php';
// stworzenie nowego obiektu "szablon" $template = new PHPTAL('my_template_file.html');
// Link class
class Link { public $href; public $title; public $text;