Jump to content

Creating global smarty variable in 1.7


Recommended Posts

Hi all,

 

I would like to create a global smarty variable, and use the value of the variable on every page of my website.

 

I assume I need to user an override to one of the Controllers? But can't get this to work in 1.7

 

 

I will then use this global variable to determine which content to display on my pages.

 

Any help appreciated.

 

 

Thanks!

 

Simon

Link to comment
Share on other sites

I have: \override\controllers\front\FrontController.php

class FrontController extends FrontControllerCore {
    public function initHeader()
{
        self::$smarty->assign('is_night', 0);
        return parent::initHeader();

    }
}

I've also tried with a module:

 

\modules\se_daynight\se_daynight.php

public function hookHeader($params)
{
   global $smarty;
   $this->smarty->assign('is_night', 0);
}
Edited by banditbirds (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...