Jump to content

[Solved] Problem: Template variable is visible in other hooks


Melander

Recommended Posts

I try to use $smarty->assign() inside a hook (I created a hook in the blockcategories module. The problem is that this parameter has the same value in the other hook(s).

 

This is the code:

 

--------------------------------------------------------------------

 

blockcategories.php

public function install()
{
 //...
  !$this->registerHook('top') OR
 //...
}

public function hookTop($params)
{
 global $smarty;
 $smarty->assign('isInTopOfPages', true);
 return $this->hookLeftColumn($params);
}

--------------------------------------------------------------------

 

 

I wish to display this blockcategories module differently based on whether it's in the hook I created or a different one.

 

Any thoughts?

 

 

 

--------------------------

SOLUTION

--------------------------

 

 

Modified hookLeftColumn() to take an argument that specifies which template to display:

public function hookLeftColumn($params, $template = 'blockcategories.tpl')
{
 //...
 $display = $this->display(__FILE__, $template, $smartyCacheId);

Edited by Melander (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...