Fixing bug when using templates inside a plugin

skala
Julio Montoya 13 years ago
parent df205a8e0c
commit 6e0be592a0
  1. 5
      main/inc/lib/plugin.lib.php
  2. 9
      main/inc/lib/template.lib.php

@ -186,8 +186,9 @@ class AppPlugin {
if (!empty($template_list)) {
foreach ($template_list as $plugin_tpl) {
if (!empty($plugin_tpl)) {
$template_plugin_file = api_get_path(SYS_PLUGIN_PATH)."$plugin_name/$plugin_tpl";
$template->display($template_plugin_file);
//$template_plugin_file = api_get_path(SYS_PLUGIN_PATH)."$plugin_name/$plugin_tpl"; //for smarty
$template_plugin_file = "$plugin_name/$plugin_tpl"; // for twig
$template->display($template_plugin_file);
}
}
}

@ -39,7 +39,14 @@ class Template {
//Twig settings
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem(api_get_path(SYS_CODE_PATH).'template');
$template_paths = array(
api_get_path(SYS_CODE_PATH).'template',
api_get_path(SYS_PLUGIN_PATH) //plugin folder
);
$loader = new Twig_Loader_Filesystem($template_paths);
$this->twig = new Twig_Environment($loader, array(
//'cache' => api_get_path(SYS_ARCHIVE_PATH),
'autoescape' => false,

Loading…
Cancel
Save