|
Hi,
I created project with Zf2 and i use many modules. I've one layout and in this one I wanna insert partial. In zf1 the signature is "public function partial($name = null, $module = null, $model = null)" And why in zf2 there's no the same signature ? Because I want to call views from another modules, or use one layout with different views like that: module/ Application/ views/ layouts/ layout.phtml header.phtml Admin/ views/ header.phtml Next question, I want to use module.config.php and have specific layout per module, did you think there's solution to do that ? In my Application/src/Application/View/Listener.php I've dispatch event to renderLayout, Why we must integrate View/Listener.php in all modules and just one is called in dispatch event (always the last one which is integrate) ? Thank and I apologize for my unfortunate English -- Pierre RAMBAUD - I N S T A N T | L U X E - 40 rue d'Aboukir - 75002 Paris - France Web : www.instantluxe.com |
|
Administrator
|
-- Pierre Rambaud <[hidden email]> wrote
(on Wednesday, 25 January 2012, 12:19 AM +0100): > I created project with Zf2 and i use many modules. I've one layout and in > this one I wanna insert partial. > > In zf1 the signature is "public function partial($name = null, $module = > null, $model = null)" > > And why in zf2 there's no the same signature ? Short answer: because we have not yet finalized the view layer. (RFC is here: http://framework.zend.com/wiki/display/ZFDEV2/RFC+-+View+Layer) Longer answer: because the view layer should not be concerned with what module the partial lives in; that's up to the renderer to determine. The reason for this is because ZF2's system is meant to allow the easy consumption of third party modules. The module likely would ship some default templates, but if you want to provide your own markup, you would write your own, and put them elsewhere (one performant way I propose in the RFC is to use maps of names to paths, as this makes overrides easy and can be generated per rendering engine). As such, using the "module" argument would be a bad call -- it would be mapping you to the wrong directory. So, for now, either create unique names or directory namespaces for your module-specific view scripts. In your example below, I might use "Application/view/app/" and "Admin/view/admin" as the root for each respective module's view scripts, allowing you to reference the "header.phtml" as "app/header.phtml" or "admin/header.phtml". (In the proposed view layer, you'd say simply "app/header" or "admin/header".) > Because I want to call views from another modules, or use one layout with > different views like that: > > module/ > Application/ > views/ > layouts/ > layout.phtml > header.phtml > Admin/ > views/ > header.phtml > > > > Next question, I want to use module.config.php and have specific layout per > module, did you think there's solution to do that ? > In my Application/src/Application/View/Listener.php I've dispatch event to > renderLayout, Why we must integrate View/Listener.php in all modules and > just one is called in dispatch event (always the last one which is > integrate) ? The view listener in the skeleton app is mainly a stop-gap measure to make layouts work at all with ZF2 until the view layer is complete. You should only need to register it once -- but the unfortunate fact is that you'll need to modify it to allow altering the layout based on the selected controller (and thus module); that functionality was not built into it. (The proposed view layer addresses layouts better.) -- Matthew Weier O'Phinney Project Lead | [hidden email] Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: [hidden email] Info: http://framework.zend.com/archives Unsubscribe: [hidden email] |
| Powered by Nabble | Edit this page |
