News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Evan Coury's Blog:
Module-specific layouts in Zend Framework 2
May 11, 2012 @ 08:07:44

Evan Coury has a new Zend Framework 2 related blog post looking at how to use module specific layouts in your application (even though, technically, it's more related to the controller).

There's really no such thing as "module-specific" anything in ZF2, so what we're really talking about is the topmost namespace of the controller being dispatched. So in the case of MyModuleControllerSomeController, the topmost namespace would be MyModle. In most cases, this will be the name of a given module.

He gives a quick piece of sample code showing a "Module" class that attaches an event on the dispatch of its request. Inside this event, he grabs the controller (target) and updates the layout via a call to the "layout" method. This is all handled in the "init" method of the module, so it should "just work" when the module is used.

0 comments voice your opinion now!
module layout zendframework2 controller


blog comments powered by Disqus

Similar Posts

The bla.st Blog: Process your URLs in PHP with Apache mod_rewrite and wildcard DNS

Jeroen Keppens' Blog: Create a modular application with Zend Framework

Daniel Cousineau's Blog: Zend Framework Module Init Script (Controller Plugin)

Pádraic Brady's Blog: Complex Views with the Zend Framework - Pt 5: The Two-Step View Pattern

Pavel Shevaev's Blog: Make php-fpm execute arbitrary PHP scripts via socket


Community Events





Don't see your event here?
Let us know!


introduction install podcast framework deployment opinion list tips symfony series language zendserver library community update release laravel package api interview

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework