Popular Post
Blog Syndications
CakePHP: Modifying layout blocks from within view elements
Added by: 18 February 2009 . 17:02
Usually a website layout consists of some main content block surrounded by common elements like a header, menu and submenu. CakePHP lets you handle these common widgets from the layout file (e.g. default.ctp) and use the view files for the "main content". In practice the controller passes all the necessary view data to both the layout and the views. But what if you have a common layout element "submenu" which should show local tasks (e.g. "edit", "new") depending on the main view and you don´t want to pass these submenu items through the controller? In this case you would need the view to "talk" to your layout and tell it "to display the submenu items edit, new and export whereever they belong".
The solution is simple and actually there is already an example included in the CakePHP framework for this: the "Javascript" helper.
Our new blog on programming is coming soon...
Added by: 11 February 2009 . 17:02
This blog will be coming very soon...
Stay tuned!

