richard
Trying not to be a rookie
Joined: 03/09/09
Posts: 17 |
Best practice with view/tags
03/13/10 5:00 AM
hi all,
I've a nav.cfm file in my view/tags folder which is called into my main layout using render view.
I build my nav from a database table.
Not sure if it's relevant but I'm trying to use the autowire functionality built into coldbox.
At the moment I see I have two options.
a) Create an object and call my model direcly from the nav.cfm file
b) Add a call to the nav in every function of each eventHandler.
Niether option feels right, how should this be done? Thanks,
Richard
|
lmajano
Veteran Master
Joined: 01/29/05
Posts: 1209 |
RE: Best practice with view/tags
03/13/10 9:37 PM
Hi Richard.
I think this is a case to build a viewlet.
Basically, you render an event:
#runEvent('nav.dynamic')#
Then in your nav handler and dynamic method, you will do your logic and then render back the view you like:
function dynamic(event){
// Get dynamic data here from modles, etc,
// render back the view return renderView('nav/dynamic');
} Luis Majano
|