There's probably no one single recommendation, so I can only speak personally. Since this occurs in a layout, across many pages, the simplest solution is to query from a View Helper. Presumably you need a View Helper anyway to format the tags. This also ties the query to the layout, and not to controllers so you can dispense with any controller/action name filtering to make sure the helper is only executed as necessary.
Paddy
Pádraic Brady
http://blog.astrumfutura.com
http://www.survivethedeepend.com
OpenID Europe Foundation Irish Representative
From: Joó Ádám <ceriak@gmail.com>
To: fw-mvc@lists.zend.com
Sent: Saturday, August 29, 2009 12:47:19 PM
Subject: [fw-mvc] Where to put common queries injected into layout?
Hi,
I would like to know where is the recommended place for common queries
and their results' injection into layouts, e.g.: fetching tags from
the database and inserting them into the footer in all actions within
the module. Should I use a plugin or an action helper? Or should I
just query the model right inside the layout?
Thanks,
Ádám
Paddy
http://blog.astrumfutura.com
http://www.survivethedeepend.com
OpenID Europe Foundation Irish Representative
From: Joó Ádám <ceriak@gmail.com>
To: fw-mvc@lists.zend.com
Sent: Saturday, August 29, 2009 12:47:19 PM
Subject: [fw-mvc] Where to put common queries injected into layout?
Hi,
I would like to know where is the recommended place for common queries
and their results' injection into layouts, e.g.: fetching tags from
the database and inserting them into the footer in all actions within
the module. Should I use a plugin or an action helper? Or should I
just query the model right inside the layout?
Thanks,
Ádám
没有评论:
发表评论