user3351236
user3351236

Reputation: 2538

How pass variables between pages in symfony 1.4?

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

Answers (2)

you can do it by include_partial('partial_name',array('variable_name'=>'variable_value'))

Upvotes: 0

Simon Cast
Simon Cast

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

Related Questions