How do you create variables in actions.class.php so that they are available in layout.php?

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

+1


a source to share


2 answers


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

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

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

      



And then use this in your layout file:

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

      

+1


a source


I think that by default you cannot, as it should be against the MVC pattern.



You are better off passing the variable to your view, but without using a global (or some sort of).

+1


a source







All Articles