// 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:
@@ -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)
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user