Fix for missing child context in sections.
This commit is contained in:
+5
-1
@@ -147,7 +147,11 @@ class Mustache {
|
|||||||
$replace .= $this->_render($content, $this->getContext($context, $local_context));
|
$replace .= $this->_render($content, $this->getContext($context, $local_context));
|
||||||
}
|
}
|
||||||
} else if ($val) {
|
} else if ($val) {
|
||||||
$replace .= $content;
|
if (is_array($val) || is_object($val)) {
|
||||||
|
$replace .= $this->_render($content, $this->getContext($context, $val));
|
||||||
|
} else {
|
||||||
|
$replace .= $content;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class ChildContext extends Mustache {
|
||||||
|
public $parent = array(
|
||||||
|
'child' => 'child works',
|
||||||
|
);
|
||||||
|
|
||||||
|
public $grandparent = array(
|
||||||
|
'parent' => array(
|
||||||
|
'child' => 'grandchild works',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<h1>{{#parent}}{{child}}{{/parent}}</h1>
|
||||||
|
<h2>{{#grandparent}}{{#parent}}{{child}}{{/parent}}{{/grandparent}}</h2>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<h1>child works</h1>
|
||||||
|
<h2>grandchild works</h2>
|
||||||
Reference in New Issue
Block a user