2013-01-25 18:36:16 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function myMod($str) {
|
|
|
|
return "(myMod)".$str."(/myMod)";
|
|
|
|
}
|
|
|
|
|
|
|
|
function myFunc($params) {
|
|
|
|
return "MyFunc:".$params["name"];
|
|
|
|
}
|
|
|
|
|
|
|
|
function myBlockFunc($params, $content) {
|
|
|
|
return "Block:".$params["name"].':'.trim($content).':Block';
|
|
|
|
}
|
|
|
|
|
2013-06-28 11:53:53 +04:00
|
|
|
function myCompiler(Fenom\Tokenizer $tokenizer, Fenom\Template $tpl) {
|
2013-01-25 18:36:16 +04:00
|
|
|
$p = $tpl->parseParams($tokenizer);
|
|
|
|
return 'echo "PHP_VERSION: ".PHP_VERSION." (for ".'.$p["name"].'.")";';
|
|
|
|
}
|
|
|
|
|
2013-06-28 11:53:53 +04:00
|
|
|
function myBlockCompilerOpen(Fenom\Tokenizer $tokenizer, Fenom\Scope $scope) {
|
2013-01-25 18:36:16 +04:00
|
|
|
return myCompiler($tokenizer, $scope->tpl);
|
|
|
|
}
|
|
|
|
|
2013-06-28 11:53:53 +04:00
|
|
|
function myBlockCompilerClose(Fenom\Tokenizer $tokenizer, Fenom\Scope $scope) {
|
2013-01-25 18:36:16 +04:00
|
|
|
return 'echo "End of compiler";';
|
|
|
|
}
|
|
|
|
|
2013-06-28 11:53:53 +04:00
|
|
|
function myBlockCompilerTag(Fenom\Tokenizer $tokenizer, Fenom\Scope $scope) {
|
2013-01-25 18:36:16 +04:00
|
|
|
$p = $scope->tpl->parseParams($tokenizer);
|
|
|
|
return 'echo "Tag ".'.$p["name"].'." of compiler";';
|
|
|
|
}
|