// Log edited, this modification on Module::displayTemplate was reverted in a better one

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10675 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-11-25 16:09:13 +00:00
parent 93f4be96b0
commit fe435bdeea
8 changed files with 53 additions and 30 deletions

View File

@@ -1198,10 +1198,8 @@ abstract class ModuleCore
return self::_isTemplateOverloadedStatic($this->name, $template);
}
public function display($file, $template, $cacheId = NULL, $compileId = NULL)
public function display($file, $template, $cacheId = null, $compileId = null)
{
$context = Context::getContext();
if (($overloaded = self::_isTemplateOverloadedStatic(basename($file, '.php'), $template)) === NULL)
$result = Tools::displayError('No template found for module').' '.basename($file,'.php');
else
@@ -1211,7 +1209,7 @@ abstract class ModuleCore
'module_template_dir' => ($overloaded ? _THEME_DIR_ : __PS_BASE_URI__).'modules/'.basename($file, '.php').'/'
));
$smarty_subtemplate = $context->smarty->createTemplate(
$smarty_subtemplate = $this->context->smarty->createTemplate(
($overloaded ? _PS_THEME_DIR_.'modules/'.basename($file, '.php') : _PS_MODULE_DIR_.basename($file, '.php')).'/'.$template,
$cacheId,
$compileId,
@@ -1223,6 +1221,31 @@ abstract class ModuleCore
return $result;
}
public static function displayTemplate($file, $template, $cacheId = null, $compileId = null)
{
$context = Context::getContext();
if (($overloaded = self::_isTemplateOverloadedStatic(basename($file, '.php'), $template)) === NULL)
$result = Tools::displayError('No template found for module').' '.basename($file,'.php');
else
{
$context->smarty->assign(array(
'module_dir' => __PS_BASE_URI__.'modules/'.basename($file, '.php').'/',
'module_template_dir' => ($overloaded ? _THEME_DIR_ : __PS_BASE_URI__).'modules/'.basename($file, '.php').'/'
));
$smarty_subtemplate = $context->smarty->createTemplate(
($overloaded ? _PS_THEME_DIR_.'modules/'.basename($file, '.php') : _PS_MODULE_DIR_.basename($file, '.php')).'/'.$template,
$cacheId,
$compileId,
$context->smarty
);
$result = $smarty_subtemplate->fetch();
}
return $result;
}
/**
* Get realpath of a template of current module (check if template is overriden too)
*