tags:

views:

113

answers:

2

In Symfony 1.2, how do you create variables in actions.class.php so that they are accessible in layout.php?

+1  A: 

I think, by default, you can't, since it should be against the MVC pattern.

You should better pass variable to your view, but without using global (or kind of).

Boris Guéry
+1  A: 

This page has some information about it: http://trac.symfony-project.org/wiki/Symfony11LayoutUpgrade

It seems you can get the desired effect using this following code:

$this->getResponse()->setSlot('title', 'insert your title here');

And then use this in the layout file:

<title><?php echo get_slot('title') ?></title>
Peter Stuifzand