Jump to content

[RESOLUT] cache module et control de Page name


Recommended Posts

Bonjour à tous.,

 

J'ai un souci de mise en cache d'un module que j'ai crée;

 

J'ai:

	function hookRightColumn($params) {
		if (!$this->isCached('blockfanfb.tpl', $this->getCacheId())) {
[...]
		} return $this->display(__FILE__, 'blockfanfb.tpl', $this->getCacheId());
	}

puis dans mon template

{if ($page_name !="order")}
[..]
{/if}

Mais du coup la mise en cache empeche le controle par page.

 

Voyez vous un moyen d'allier les deux?

 

Edited by jd440 (see edit history)
Link to comment
Share on other sites

Et voici ma solution.

function hookRightColumn($params) {
	$page_en_cour = $this->context->smarty->tpl_vars['page_name']->value;
$cacheId = $this->getCacheId($this->name.'|produt|'.Tools::getValue('id_product'));
	if (!$this->isCached('blockfanfb.tpl', $cacheId)) {

	  [...]
	  $smarty->assign(array(
			  [...]
			  'ou_on_est'		=> $page_en_cour
		  ));
	} return $this->display(__FILE__, 'blockfanfb.tpl', $cacheId);
}

template

{if ($ou_on_est !="order")}
[..]
{/if}
Edited by jd440 (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...