- implemented $smarty.block.name.parent to access parent block content

- fixed smarty.class
This commit is contained in:
Uwe.Tews
2009-03-26 21:06:02 +00:00
parent 9f95d63ab7
commit 000e5c7892
3 changed files with 11 additions and 4 deletions

View File

@@ -1,6 +1,9 @@
03/26/2009
- fixed parser not to create error on `word` in double quoted strings
- allow PHP array(...)
- implemented $smarty.block.name.parent to access parent block content
- fixed smarty.class
03/23/2009
- fixed {foreachelse} and {forelse} tags

View File

@@ -406,7 +406,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
* @param string $code the error code
*/
class SmartyException {
public function printException($e)
public static function printException($e)
{
echo "Code: " . $e->getCode() . "<br />Error: " . htmlentities($e->getMessage()) . "<br />"
. "File: " . $e->getFile() . "<br />"

View File

@@ -83,7 +83,11 @@ class Smarty_Internal_Compile_Smarty extends Smarty_Internal_CompileBase {
case 'global':
return "\$_smarty_tpl->smarty->getGlobalVariable($_index[1])->value";
case 'block':
return "'".addcslashes($compiler->template->block_data[trim($_index[1],"'")]['source'],"'")."'";
if ($_index[2] == '\'parent\'') {
return "'" . addcslashes($compiler->template->block_data[trim($_index[1], "'")]['source'], "'") . "'";
} else {
return "''";
}
case 'ldelim':
$_ldelim = $this->smarty->left_delimiter;
return "'$_ldelim'";
@@ -97,8 +101,8 @@ class Smarty_Internal_Compile_Smarty extends Smarty_Internal_CompileBase {
break;
}
if (isset($_index[1])) {
$compiled_ref = $compiled_ref . "[$_index[1]]";
}
$compiled_ref = $compiled_ref . "[$_index[1]]";
}
return $compiled_ref;
}
}