Our Forums are now closed. Please go to our Google Mailing List for help. This site will remain open for historical purposes.
ColdBox Framework Forums Home | Profile | Search | Login | RSS

 pdf Print PDF   Previous Page  Page: 1   Next Page

Thread: Best practice with view/tags
Created on: 03/13/10 05:00 AM Replies: 2
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
Link | Top | Bottom
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
Link | Top | Bottom
richard
Trying not to be a rookie

Joined: 03/09/09
Posts: 17
RE: Best practice with view/tags
03/15/10 6:02 AM

cool - thanks Luis
Link | Top | Bottom

Galleon Forums V1.7.008 was created by Raymond Camden