Nesting Layouts Possible?

Hi,

I just finished reading through the Layouts and Views guide:

http://ortus.svnrepository.com/coldbox/trac.cgi/wiki/cbLayoutsViewsGuide

I'm trying to find out if it's possible next layouts so that I can
have layouts and sub-layouts for a site. As an example, I have a site
with a main layout and navigation that should go on every page. That's
easy enough, I would use my Layout.Main for that... However, I have a
subsection for authenticated users. My initial though was to create a
new layout, Layout.Admin, and all views in the users folder would se
this Layout. However, this creates duplicate code, because the layout
must have all of the same base navigation. I could put all of my site
navigation into a custom tag and have it rendered in both Layouts, but
that also duplicates the layout...

So my question then is, is there a convention for this inside ColdBox,
or should I fall back on standard CustomTag layout methodologies that
I'm used to?

Dan

Tough,

I would suggest breaking into re-usable pieces. Like navigation as a separate view, then you can just render the navigation and even cache it within any layout.

Layout 1:

#renderView('tags/navigation')#

Layout 2:

#renderView('tags/navigation')#

But it seems they are different layouts. I would create two different layouts and try to get the reusable content into a tags folder in the views and render them wherever your layout needs them.

Luis

That's probably the way I'll go. I'm used to doing stuff like:

Layout.Main
<cf_layout>

<cf_content>
    My content, or rendered view, goes here
</cf_content

</cf_layout>

I think the above will still work just fine in multiple layouts. I'll
get the ability to make the layouts flexible, and still keep all of
the reusable bits in custom tags. They're for layout after all ;-).

My Layout.User would look like this:

Layout.User
<cf_layout>
<cf_userNavigation />
<cf_content>
    My content, or rendered view, goes here
</cf_content

</cf_layout>

Thanks for the reply.

Dan

I recommend you use renderView(), this way your views (tags) can have access to the framework. If not, you will be doing nasty: caller.something in order to get values and the sort.

LUis