diff --git a/classes/Gender.php b/classes/Gender.php index 4337f5ba8..a8fe95828 100644 --- a/classes/Gender.php +++ b/classes/Gender.php @@ -85,15 +85,10 @@ class GenderCore extends ObjectModel return ObjectModel::hydrateCollection('Gender', $results, $id_lang); } - public static function getStaticImage($id, $use_unknown = false) - { - if (!file_exists(_PS_GENDERS_DIR_.$id.'.jpg')) - return ($use_unknown) ? _PS_ADMIN_IMG_.'unknown.gif' : false; - return _THEME_GENDERS_DIR_.$id.'.jpg'; - } - public function getImage($use_unknown = false) { - return Gender::getStaticImage($this->id, $use_unknown); + if (!file_exists(_PS_GENDERS_DIR_.$this->id.'.jpg')) + return ($use_unknown) ? _PS_ADMIN_IMG_.'unknown.gif' : false; + return _THEME_GENDERS_DIR_.$this->id.'.jpg'; } } \ No newline at end of file diff --git a/classes/Module.php b/classes/Module.php index b8777d231..8fb91713f 100644 --- a/classes/Module.php +++ b/classes/Module.php @@ -95,6 +95,11 @@ abstract class ModuleCore /** @var Context */ protected $context; + /** + * @var Smarty_Data + */ + protected $smarty; + /** * Constructor * @@ -104,6 +109,7 @@ abstract class ModuleCore public function __construct($name = null, Context $context = null) { $this->context = $context ? $context : Context::getContext(); + $this->smarty = $this->context->smarty->createData($this->context->smarty); if ($this->name == NULL) $this->name = $this->id; @@ -1192,17 +1198,27 @@ abstract class ModuleCore return self::_isTemplateOverloadedStatic($this->name, $template); } - public static function display($file, $template, $cacheId = NULL, $compileId = NULL) + public function display($file, $template, $cacheId = NULL, $compileId = NULL) { $context = Context::getContext(); - $context->smarty->assign('module_dir', __PS_BASE_URI__.'modules/'.basename($file, '.php').'/'); if (($overloaded = self::_isTemplateOverloadedStatic(basename($file, '.php'), $template)) === NULL) $result = Tools::displayError('No template found for module').' '.basename($file,'.php'); else { - $context->smarty->assign('module_template_dir', ($overloaded ? _THEME_DIR_ : __PS_BASE_URI__).'modules/'.basename($file, '.php').'/'); - $result = $context->smarty->fetch(($overloaded ? _PS_THEME_DIR_.'modules/'.basename($file, '.php') : _PS_MODULE_DIR_.basename($file, '.php')).'/'.$template, $cacheId, $compileId); + $this->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, + $this->smarty + ); + + $result = $smarty_subtemplate->fetch(); } return $result; }