In Symfony 1.2, how do you create variables in actions.class.php so that they are accessible in layout.php?
views:
113answers:
2
+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
2009-05-25 16:59:14
+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
2009-05-25 17:19:12