Re: [fw-general] Zend_Layout - working out
On Dec 13, 2007 7:01 PM, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote: > > Fixed; see ZF-2305, and r7102 of svn. > Hero of the day! Thank you very much! -- Łukasz Wojciechowski
Re: [fw-general] Zend_Layout - working out
-- Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote (on Thursday, 13 December 2007, 12:49 PM -0500): > -- Łukasz Wojciechowski <[EMAIL PROTECTED]> wrote > (on Thursday, 13 December 2007, 06:10 PM +0100): > > One more question :) I try to do Zend_Layout::startMvc(); in > > controller plugin but on every stage (routeShutdown() etc) I get error > > > > Fatal error: Call to a member function getBody() on a non-object in > > (...)lib\Zend\Layout\Controller\Plugin\Layout.php on line 127 > > > > any ideas? > > Wow! Long time since I delved into the plugin broker code. There's > definitely an issue. > > Basically, the plugin broker sets the request/response objects in the > individual plugins when setRequest()/setResponse() are called on the > plugin broker... which only happens at the beginning of the dispatch > loop. That means any plugin registered later than that has no access to > the response or request object. > > I'll get a fix in shortly. Fixed; see ZF-2305, and r7102 of svn. -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] Zend_Layout - working out
-- Łukasz Wojciechowski <[EMAIL PROTECTED]> wrote (on Thursday, 13 December 2007, 06:10 PM +0100): > One more question :) I try to do Zend_Layout::startMvc(); in > controller plugin but on every stage (routeShutdown() etc) I get error > > Fatal error: Call to a member function getBody() on a non-object in > (...)lib\Zend\Layout\Controller\Plugin\Layout.php on line 127 > > any ideas? Wow! Long time since I delved into the plugin broker code. There's definitely an issue. Basically, the plugin broker sets the request/response objects in the individual plugins when setRequest()/setResponse() are called on the plugin broker... which only happens at the beginning of the dispatch loop. That means any plugin registered later than that has no access to the response or request object. I'll get a fix in shortly. -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] Zend_Layout - working out
One more question :) I try to do Zend_Layout::startMvc(); in controller plugin but on every stage (routeShutdown() etc) I get error Fatal error: Call to a member function getBody() on a non-object in (...)lib\Zend\Layout\Controller\Plugin\Layout.php on line 127 any ideas? -- Łukasz Wojciechowski
Re: [fw-general] Zend_Layout - working out
-- Łukasz Wojciechowski <[EMAIL PROTECTED]> wrote (on Tuesday, 11 December 2007, 03:11 PM +0100): > So I managed to run Zend_Layout and I got to the "load of questions" point. > > OK, I get the idea of 2 step design but can't get it working ;) I mean > logically ... I have controller NewsController in witch I have action > show so I fetch all news in this action and want to show it on layout > without wondering about navibar (kept in DB) or anything else. How am > I supposed to retrieve navi bar in my layout. Using > $this->layout()->render() doesn't actually dispatch my action, right? > it only renders script. You should never need to call render() on the layout object from the layout view helper. The process is really fairly simple: * Call Zend_Layout::startMvc() with your configuration options either in your bootstrap or in a plugin (preferably an early running one) * Create a layout script that, at the minimum, renders the content segment of the layout object: layout()->content ?> * That's it. Zend_Layout and its various controller plugins and helpers take care of the rest. By default, Zend_Layout looks for a script called 'layout.phtml' on your view script path. If you provide a layoutPath to Zend_Layout, it will look only in that directory for layout scripts. You can provide a layout path in a couple ways: * Pass the layoutPath option to startMvc(): Zend_Layout::startMvc(array('layoutPath' => 'path/to/layouts/')); * Pass a layoutPath key in a Zend_Config object passed to startMvc(): Zend_Layout::startMvc($config); * $layout->setLayoutPath(); > I tried to use view plugins ... But it's quite weird place to put navi > fetch logic in it? ... View helpers are actually a natural fit for things like navigation. If you look at all the classic MVC diagrams, they show the view as having access to the model for read purposes; since navigation is typically a read-only sort of thing, having a helper for it makes sense. > I want to get the idea right, I used Smarty and templates so far and > I'm just used to that approach. -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
[fw-general] Zend_Layout - working out
So I managed to run Zend_Layout and I got to the "load of questions" point. OK, I get the idea of 2 step design but can't get it working ;) I mean logically ... I have controller NewsController in witch I have action show so I fetch all news in this action and want to show it on layout without wondering about navibar (kept in DB) or anything else. How am I supposed to retrieve navi bar in my layout. Using $this->layout()->render() doesn't actually dispatch my action, right? it only renders script. I tried to use view plugins ... But it's quite weird place to put navi fetch logic in it? ... I want to get the idea right, I used Smarty and templates so far and I'm just used to that approach. -- Łukasz Wojciechowski