This commit is contained in:
Jeremy Bush 2010-08-20 09:14:48 -05:00
parent d7b1e5ecc7
commit 947d8379b9
2 changed files with 30 additions and 20 deletions

View file

@ -2,6 +2,8 @@
class Kohana_Kostache extends Mustache class Kohana_Kostache extends Mustache
{ {
protected $_partials_processed = FALSE;
/** /**
* KOstache class factory constructor. * KOstache class factory constructor.
* *
@ -118,6 +120,8 @@ class Kohana_Kostache extends Mustache
} }
public function render($template = null, $view = null, $partials = null) public function render($template = null, $view = null, $partials = null)
{
if (NULL === $template)
{ {
// Override the template location to match kohana's conventions // Override the template location to match kohana's conventions
if ( ! $this->_template) if ( ! $this->_template)
@ -137,8 +141,11 @@ class Kohana_Kostache extends Mustache
throw new Kohana_Exception('Template file not found: templates/'.$view_location); throw new Kohana_Exception('Template file not found: templates/'.$view_location);
$this->_template = file_get_contents($this->_template); $this->_template = file_get_contents($this->_template);
}
// Convert partials to expanded template strings // Convert partials to expanded template strings
if ( ! $this->_partials_processed)
{
foreach ($this->_partials as $key => $partial_template) foreach ($this->_partials as $key => $partial_template)
{ {
if ($location = Kohana::find_file('templates', $partial_template, 'mustache')) if ($location = Kohana::find_file('templates', $partial_template, 'mustache'))
@ -147,6 +154,9 @@ class Kohana_Kostache extends Mustache
} }
} }
$this->_partials_processed = TRUE;
}
return parent::render($template, $view, $partials); return parent::render($template, $view, $partials);
} }
} }

2
vendor/mustache vendored

@ -1 +1 @@
Subproject commit ec562fea0916b8d8dedba516d748739a6c126ec0 Subproject commit 8b1c9c113c4e189923e4874be6fca5be715239ac