Reputation: 2538
I want to pass a variable between pages but do not change every link for that. Is there a way to do that - pass variables between templates and actions. Do not need to keep it in session. In url ony.
Upvotes: 0
Views: 186
Reputation: 1
you can do it by include_partial('partial_name',array('variable_name'=>'variable_value'))
Upvotes: 0
Reputation: 255
You can use URL parameters which which can be accessed by each action and in templates. Although this is often better done using Session storage.
URL parameters:
http://www.example.com/something?value=[some value]
Then in the action you can access using $request->getParameter('value')
and in the template using $sf_param->get('value')
. Keep in mind that you can pass variables from the action to relevant template using the $this->value
variable which can accessed in template by $value
.
Then you just adjust the buttons/links in the template to have a different value of the parameter value
as needed.
Upvotes: 1