View_Smarty exposes a bunch of options but not plugins_dir. This is necessary to get custom plugins working with Smarty.
I'm currently running the egregious hack below in the after method of my BaseController. Save me from it? :)
// After View_Smarty in fuel is patched to allow setting of a
// plugins_dir in config we won't need to do it like this.
if (is_object($this->canvas)) {
$rc = new \ReflectionClass($this->canvas);
if ($rc->hasMethod('parser')) {
$parser = $this->canvas->parser();
} elseif ($rc->hasProperty('_view')) {
$parser = $this->canvas->_view->parser();
} else {
throw new YokoException("Unable to initialize Smarty i18n plugin.");
}
$smartyParam = 'plugins_dir';
$ourPluginsDir = APPPATH . '/smarty';
$pluginsDir = array_merge($parser->$smartyParam, [$ourPluginsDir]);
$parser->$smartyParam = $pluginsDir;
}
View_Smarty exposes a bunch of options but not plugins_dir. This is necessary to get custom plugins working with Smarty.
I'm currently running the egregious hack below in the after method of my BaseController. Save me from it? :)