From 6c99b48ebf058d0e950a126e7cc0ee6d1377b468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Tue, 8 Jan 2013 10:32:09 +0100 Subject: [PATCH] [*] MO: Add smarty cache on blocksearch --- modules/blocksearch/blocksearch.php | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/modules/blocksearch/blocksearch.php b/modules/blocksearch/blocksearch.php index e1e5baf92..3df13fbc8 100644 --- a/modules/blocksearch/blocksearch.php +++ b/modules/blocksearch/blocksearch.php @@ -80,16 +80,23 @@ public function hookDisplayMobileHeader($params) public function hookRightColumn($params) { - $this->calculHookCommon($params); - $this->smarty->assign('blocksearch_type', 'block'); - return $this->display(__FILE__, 'blocksearch.tpl'); + if (!$this->isCached('blocksearch.tpl', $this->getCacheId())) + { + $this->calculHookCommon($params); + $this->smarty->assign('blocksearch_type', 'block'); + } + return $this->display(__FILE__, 'blocksearch.tpl', $this->getCacheId()); } public function hookTop($params) { - $this->calculHookCommon($params); - $this->smarty->assign('blocksearch_type', 'top'); - return $this->display(__FILE__, 'blocksearch-top.tpl'); + if (!$this->isCached('blocksearch-top.tpl', $this->getCacheId('blocksearch-top'))) + { + $this->calculHookCommon($params); + $this->smarty->assign('blocksearch_type', 'top'); + } + + return $this->display(__FILE__, 'blocksearch-top.tpl', $this->getCacheId('blocksearch-top')); } /** @@ -110,5 +117,11 @@ public function hookDisplayMobileHeader($params) return true; } + + protected function getCacheId($name = null) + { + $cache_id = parent::getCacheId($name); + return $cache_id.'_'.(int)Tools::usingSecureMode(); + } }