/** * compile TALES expression according to current talesMode * @return string with PHP code or array with expressions for TalesChainExecutor */ public function evaluateExpression($expression) { if ($this->getTalesMode() === 'php') { return PHPTAL_Php_TalesInternal::php($expression); } return PHPTAL_Php_TalesInternal::compileToPHPExpressions($expression, false); }
/** * returns PHP code that will evaluate given TALES expression. * e.g. "string:foo${bar}" may be transformed to "'foo'.phptal_escape($ctx->bar)" * * Expressions with alternatives ("foo | bar") will cause it to return array * Use phptal_tale() if you always want string. * * @param bool $nothrow if true, invalid expression will return NULL (at run time) rather than throwing exception * @return string or array */ function phptal_tales($expression, $nothrow = false) { return PHPTAL_Php_TalesInternal::compileToPHPExpressions($expression, $nothrow); }