mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
Fix #75: macros don's share between child and parent templates
This commit is contained in:
parent
1f9a56500e
commit
e9a60041c4
@ -517,6 +517,7 @@ class Compiler
|
||||
$t->_extended = true;
|
||||
$tpl->addDepend($t);
|
||||
$t->_compatible = & $tpl->_compatible;
|
||||
$t->macros = & $tpl->macros;
|
||||
$t->blocks = & $tpl->blocks;
|
||||
$t->compile();
|
||||
if ($t->uses) {
|
||||
|
@ -1254,6 +1254,7 @@ class Template extends Render
|
||||
$macro = false;
|
||||
if (isset($this->macros[$name])) {
|
||||
$macro = $this->macros[$name];
|
||||
$recursive = $macro['recursive'];
|
||||
} else {
|
||||
foreach ($this->_stack as $scope) {
|
||||
if ($scope->name == 'macro' && $scope['name'] == $name) { // invoke recursive
|
||||
@ -1280,8 +1281,10 @@ class Template extends Render
|
||||
}
|
||||
$n = sprintf('%u_%d', crc32($this->_name), $this->i++);
|
||||
if ($recursive) {
|
||||
$recursive['recursive'] = true;
|
||||
$body = '$tpl->getMacro("' . $name . '")->__invoke($tpl);';
|
||||
if($recursive instanceof Scope) {
|
||||
$recursive['recursive'] = true;
|
||||
}
|
||||
} else {
|
||||
$body = '?>' . $macro["body"] . '<?php';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user