Yip, the api does state "Allows a template or element to set a variable that will be available in a layout or other element", but maybe this is when the element is being called from the view not the layout?
People are not really supposed to read your layout though, that is set and should rarely be changed. Plus it's a lot cleaner to only be echoing $content_for_layout, $menu_for_layout etc. than it is to be calling all view data from the layout. However, I am not experienced enough with MVC to give a compelling argument against it, I just know when something rubs against Cake's conventions then it;s normally not a good idea. HTH, Paul. On Sep 9, 9:18 pm, Xoubaman <[email protected]> wrote: > http://api13.cakephp.org/class/view#method-Viewsethttp://book.cakephp.org/view/1086/set > > Someone of the core team answered that Var::set could be used to solve a > similar issue in a post I here found when searching to my question. Don't > remember the search subject now :( > > I mean cleaner in the sense of it's more readable one layout with some echo > $var that another one with some echo $this->element(name, params stuff), > almost in the application I'm developing. Maybe it's not the most elegant > way, but, if we should not set vars in the views, why is still a method to > do it? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
