segments with render() implies you know the name of the segment within the
controller.
I register all iterations into the request object (the 'defaults' section). It
is a separate plugin (and not the controller) which handles this information
(with pre/post dispatch hooks). Your method requires for each action in all
controllers from all modules duplicated code. At the bottom of each action I
have to check if there is a no-default contentKey and render the view with
this info instead of the default behaviour.
The possibility to handle it all in one plugin, separated from all modules is
in my opinion a much cleaner option. Is it possible to make this happen with
default components or should I extend a Zend class myself?
Regards, Jurian
Op donderdag 30 april 2009 schreef Remy Damour <remy.damour@gmail.com>:
> calling $controller->render(null, 'your-action-content-key'); seems to be
> for this (or do i miss sthg?).
> So far, worked for me quite well.
> Remy
>
> On Thu, Apr 30, 2009 at 5:06 PM, Jurian Sluiman
>
> <subscribe@juriansluiman.nl>wrote:
> > Hi all,
> > I'm quite new to ZF but manage to create some complex systems in a sort
> > time.
> > One thing I don't get is creating content into more than one content key
> > from
> > Zend_Layout.
> >
> > I want to dispatch more things in the dispatch loop. Therefore, I have a
> > plugin with a postDispatch() hook. It looks if there need to be an
> > iteration
> > again, it sets the request object with the new data and reset the
> > dispatched
> > flag.
> > The content of both (or even more) loops should not always be stored in
> > the same key (default: content). It is possible to have one action stored
> > in the
> > key "one" and the second one in "two". To manage it I created a
> > preDispatch()
> > hook which sets the content key (setContentKey()) before each dispatch
> > (of course only when it's defined to have a custom content key).
> >
> > The result is not what I want: all the content is appended into one key,
> > the
> > last one which is set through setContentKey().
> >
> > How is it possible to manage the result I'd like? Thanks in advance for
> > any help!
> > Best regards,
> > Jurian Sluiman
没有评论:
发表评论