Nested Layouts ++

Hi folks,

I've read some threads on the list regarding this but I'm still confused about what the best approach might be, and some of the threads referred to outdated documentation.

My top nav is something like:

- products
- services
- about us

I'm using conventions to render my views so http://mysite/services/awesome-skillz would render (by convention) the view /services/awesome-skillz.cfm

in the services handler I want to use a nested layout so that i can display a sub nav on every services view. Ideally i'm looking for an elegant way to use a nested layout and decouple from all of the views.

a couple of options come to mind, and would appreciate your advice

1. set a layout attribute in a route for /services/:action - not sure if this would work though because i think it sets the outer layout
2. evaluate event.getCurrentRoute() in the outer layout and specify an inner layout in renderView() if the handler is "services"
3. somehow use the renderer plugin to acheive
4. ???

appreciate your thoughts on this.

Thanks.

Nolan

Personally, I do something similar to number 2

in my main layout, I have something like

<div class="subnav">
#runEvent(prc.xehSubNav)#
</div>

and then in maybe the prehandler if your case, I set the prc.xehSubNav = to an event that returns the html for the subnav.

Thats my approach.

Curt Gratz
Computer Know How

Thanks Curt.

I'll give that a go. Cheers.

Nolan

Can I also add that views can and maybe should be sometimes independent of
their controllers, especially in these types of cases.

For example, let's say that one of the views could be used in multiple
positions. In this case it is not hard and maybe a good idea to use a
runEvent() in the view to decouple it from the handler.

Use case for this would be my blog, I have a viewlet that is actually used
in about 3-4 pages that the user might see and the handler in this case
doesn't get the information it requires, I do this in the view instead and
that means I can reuse that viewlet in as many places as I need.

There is more information in the documentation on viewlets and I would
suggest reading up on that. Now viewlets are not for everyone, but it might
be what you are looking for here.

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

From: coldbox@googlegroups.com [mailto:coldbox@googlegroups.com] On
Behalf Of Nolan Dubeau
Sent: Thursday, 7 July 2011 3:04 AM
To: coldbox@googlegroups.com
Subject: Re: [coldbox:10681] Nested Layouts ++

Thanks Curt.

I'll give that a go. Cheers.

Nolan

> Personally, I do something similar to number 2
>
> in my main layout, I have something like
>
> <div class="subnav">
> #runEvent(prc.xehSubNav)#
> </div>
>
> and then in maybe the prehandler if your case, I set the prc.xehSubNav =
to an event that returns the html for the subnav.
>
> Thats my approach.
>
> Curt Gratz
> Computer Know How
>
> ________________________________________
> From: coldbox@googlegroups.com [coldbox@googlegroups.com] on
behalf of
> Nolan Dubeau [nolandubeau@gmail.com]
> Sent: Tuesday, July 05, 2011 9:22 PM
> To: ColdBox Platform
> Subject: [coldbox:10668] Nested Layouts ++
>
> Hi folks,
>
> I've read some threads on the list regarding this but I'm still confused

about

what the best approach might be, and some of the threads referred to
outdated documentation.
>
> My top nav is something like:
>
> - products
> - services
> - about us
>
> I'm using conventions to render my views so
> http://mysite/services/awesome-skillz would render (by convention) the
> view /services/awesome-skillz.cfm
>
> in the services handler I want to use a nested layout so that i can

display a

sub nav on every services view. Ideally i'm looking for an elegant way to

use