Kostache_Layout: Load content as mustache source
This fixes issues caused by the content partial being rendered and then injected as a partial in the layout template and being rendered again
This commit is contained in:
parent
57c4b91d8b
commit
598a60b09b
|
@ -40,11 +40,18 @@ class Kohana_Kostache {
|
|||
{
|
||||
if ($template == NULL)
|
||||
{
|
||||
$template = explode('_', get_class($class));
|
||||
array_shift($template);
|
||||
$template = implode('/', $template);
|
||||
$template = $this->_detect_template_path($class);
|
||||
}
|
||||
|
||||
return $this->_engine->loadTemplate($template)->render($class);
|
||||
}
|
||||
|
||||
protected function _detect_template_path($class)
|
||||
{
|
||||
$path = explode('_', get_class($class));
|
||||
array_shift($path);
|
||||
|
||||
return implode('/', $path);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,11 +34,13 @@ class Kohana_Kostache_Layout extends Kohana_Kostache {
|
|||
|
||||
public function render($class, $template = NULL)
|
||||
{
|
||||
$this->_engine->setPartials(
|
||||
array(
|
||||
Kostache_Layout::CONTENT_PARTIAL => parent::render($class, $template)
|
||||
)
|
||||
);
|
||||
$content = $this->_engine
|
||||
->getLoader()
|
||||
->load($this->_detect_template_path($class));
|
||||
|
||||
$this->_engine->setPartials(array(
|
||||
Kostache_Layout::CONTENT_PARTIAL => $content
|
||||
));
|
||||
|
||||
return $this->_engine->loadTemplate($this->_layout)->render($class);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue