Get loading working

This commit is contained in:
Jeremy Bush 2012-10-23 22:22:15 -05:00
parent 8906a63e8e
commit c08b7a3a23
2 changed files with 9 additions and 5 deletions

View file

@ -14,7 +14,7 @@ abstract class Kohana_Kostache {
const VERSION = '4.0.0';
public static function engine()
public static function engine($template_name)
{
$m = new Mustache_Engine(
array(
@ -25,5 +25,7 @@ abstract class Kohana_Kostache {
},
)
);
return $m->loadTemplate($template_name);
}
}

View file

@ -3,12 +3,13 @@
class Mustache_Loader_Kohana implements Mustache_Loader
{
private $_base_dir = 'templates';
private $_extension = '.mustache';
private $_extension = 'mustache';
private $_templates = array();
public function construct($base_dir = NULL, $options = array())
public function __construct($base_dir = NULL, $options = array())
{
$this->_base_dir = $base_dir;
if ($base_dir)
$this->_base_dir = $base_dir;
if (isset($options['extension']))
{
@ -26,8 +27,9 @@ class Mustache_Loader_Kohana implements Mustache_Loader
return $this->_templates[$name];
}
protected function load_file($name)
protected function _load_file($name)
{
$filename = Kohana::find_file($this->_base_dir, $name, $this->_extension);
return file_get_contents($filename);
}
}