예제 #1
0
 /**
  * compile TALES expression according to current talesMode
  * @return string with PHP code or array with expressions for TalesChainExecutor
  */
 public function evaluateExpression($expression)
 {
     if ($this->_talesMode === 'php') {
         return PHPTAL_Php_TalesInternal::php($expression);
     }
     return PHPTAL_Php_TalesInternal::compileToPHPStatements($expression, false);
 }
예제 #2
0
파일: Tales.php 프로젝트: rafalenden/KioCMS
/**
 * 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::compileToPHPStatements($expression, $nothrow);
}