sidebar with dynamic links

i have read the sections on viewlets and alot of other threads in this
forum and wonder what is the best practice for implementing a sidebar
in my site that has either links or any other layout attributes that
are different from page to page. I see the real use of a viewlet as a
self-sufficient widget.. but i need interaction and communication
between the main event and the viewlet (which content it is to
paint)

Would a sidebar like this be a good candidate for a viewlet? if so,
then how do you run the event in the viewlet that tells the event
handler what current page i am currently on in order to pull the
correct content? i believe someone mentioned using the flash RAM?

does this sound right.

1) main event sets a currentPageID in the flash ram
2) prepareviewlet handler reads the var and runs a query etc to get
variable data that is passed back to veiwlet
3) viewlet loops voer rc.query and paints the links accordingly

could be that some pages do not have a sidebar at all in which case
there the veiwlet or the containing div would need to be suppressed

is there a better way?

any suggestions would be welcome..

Is this for changing content within a div, and not a total page refresh? Aka
Ajax stuff?

Regards,
Andrew Scott
http://www.andyscott.id.au/

From: coldbox@googlegroups.com [mailto:coldbox@googlegroups.com] On
Behalf Of SRC
Sent: Wednesday, 15 September 2010 6:28 AM
To: ColdBox Platform
Subject: [coldbox:5789] sidebar with dynamic links

i have read the sections on viewlets and alot of other threads in this

forum

and wonder what is the best practice for implementing a sidebar in my site
that has either links or any other layout attributes that are different

from

page to page. I see the real use of a viewlet as a self-sufficient

widget.. but i

need interaction and communication between the main event and the
viewlet (which content it is to
paint)

Would a sidebar like this be a good candidate for a viewlet? if so, then

how

do you run the event in the viewlet that tells the event handler what

current

page i am currently on in order to pull the correct content? i believe
someone mentioned using the flash RAM?

does this sound right.

1) main event sets a currentPageID in the flash ram
2) prepareviewlet handler reads the var and runs a query etc to get

variable

data that is passed back to veiwlet
3) viewlet loops voer rc.query and paints the links accordingly

could be that some pages do not have a sidebar at all in which case there

the

not currently, (but i am interested to hear what you would say if it were…) because i am experimenting with something else in that direction

i am more looking for a systemic approach to letting a viewlet , in this case a sidebar with lots of links and other stuff – search box etc,-- paint itself by knowing what the current page is.

Scott,

You could have your sidebar viewlet just check the event.getCurrentEvent() and show the links you wish based on that. FYI

    <cfif event.getCurrentEvent() EQ “general.home”>

  • some thing to show if only on the home page
  • <cfif event.getCurrentEvent() EQ “general.aboutus”>

  • something to show if only on the about us page

Is that what you are looking for.

Curt