Monday, February 17, 2014

Re: Set "title_for_layout" in controller or view?



On Monday, 17 February 2014 09:25:59 UTC+1, perumal wrote:
Hi,

The best practice well be setting title in controller.

I disagree. You _can_ set the title from a controller, but why do you consider that best-practice place to set it?

The title is view-related content, the controller should know as little as possible about what happens in the render process and just be passing variables around.

This in a view file keeps view logic in the view:

    $this->set('title', __('This is the title')); 

AD

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: