I know there’s a few threads on here about passing variables to the template using partials or slots. My question is, how do you define that variable so that no matter what page you are on, the variable is still accessible. I know each one of the actions “extend” sfActions but is there a way to access that and set an action for the site as a whole?
Edit:
Every user has a field in the sfUser table that I would like displayed at the top of every page. Here is the code I would like to use but I’m not sure where to put or or how to pass it to the partial on the template page.
$this->user = $this->getUser()->getGuardUser();
$this->activeitems = $this->user->getActiveItems();
In every template, you can access your user information using
$sf_user. It returns amyUserobject.If you’ve installed sfGuard, this class should extends
sfGuardSecurityUser. And inside this class, you can retrieve the sfGuardUser object using->getGuardUser()method.So to retrieve this information inside any templates, you can do: