This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » support » symfony 1.3 and 1.4 » [SOLVED] Variables accessible from every modules action and template
[SOLVED] Variables accessible from every modules action and template [message #103285] Fri, 30 July 2010 12:05 Go to next message
garrett91  is currently offline garrett91
Messages: 230
Registered: September 2007
Faithful Member
Hi,

I have a couple of parameters that I would like to be accessible easily from every module, preferably as a variable.

I see two main ways of approaching this:
1. Pass the variables around as parameters between every web page, using getParameter() to load them into php variables in every action.

2. Use session variables, loading them into php variables in every action.

However, what I would really like is to write that code once. I would like to be able to read the parameters, or session variables. into a php variable that every action in every module could then use.

Is there a way to do this? Where would I place that code?

Best regards,

Chris.

[Updated on: Fri, 30 July 2010 13:41]

Re: Variables accessible from every modules action and template [message #103288 is a reply to message #103285 ] Fri, 30 July 2010 12:31 Go to previous messageGo to next message
xplo  is currently offline xplo
Messages: 428
Registered: September 2008
Faithful Member
session sounds best to me.
MyUser class is there for that, there is a method that initialize the session, you could override it to add your own variable.
Re: Variables accessible from every modules action and template [message #103294 is a reply to message #103288 ] Fri, 30 July 2010 13:41 Go to previous message
garrett91  is currently offline garrett91
Messages: 230
Registered: September 2007
Faithful Member
Thank you. I had previously dismissed the myUser class (I dont know why) but it does actually fit my need very well.
Previous Topic:doctrine / createQuery / leftjoin
Next Topic:For one model, many forms if different updates ?
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software