Subnavigation best practices in FW/1

81 views
Skip to first unread message

jbigelow

unread,
Feb 24, 2010, 6:30:08 PM2/24/10
to framework-one
Hey folks!

I'm playing around with FW/1 to decide if I'd like to move our
organization to it from Fusebox. I love the simplicity. I haven't
written more than a few hundred lines of code in the last couple of
years but am realizing how much I miss coding after moving to
management. I'm struggling with something that sounds like it ought
to be pretty simple.

I'm building a site that has global navigation across the top and
sectional navigation down the left side. The global navigation is in
layouts/default.cfm. I want to repeat the same navigation in every
view of a section of the site (i.e. have the same list of links on the
left side of every page in /admin/ section without having to repeat
the code. I know there's an easy way to do so within the framework
and sticking with the elegant simplicity of FW/1 but am struggling to
find the best way to do so.

Should I just create a /navigation/[section].cfm for each subsection
and include that with #view('navigation/admin')#? Should I create a
subnavigation/default.cfm and use a switch to determine which links to
display?

How should I go about this?

Thanks!

Sean Corfield

unread,
Feb 25, 2010, 11:20:21 PM2/25/10
to framew...@googlegroups.com
On Wed, Feb 24, 2010 at 3:30 PM, jbigelow <jbig...@gmail.com> wrote:
> I'm building a site that has global navigation across the top and
> sectional navigation down the left side.  The global navigation is in
> layouts/default.cfm.  I want to repeat the same navigation in every
> view of a section of the site (i.e. have the same list of links on the
> left side of every page in /admin/ section without having to repeat
> the code.  I know there's an easy way to do so within the framework
> and sticking with the elegant simplicity of FW/1 but am struggling to
> find the best way to do so.

Sounds like you want a section-specific layout that adds navigation?

layouts/mysection.cfm:
<cfoutput>
<div id="wrap">
<div id="sidenav>
#view('navigation/admin')#
</div>
<div id="main">
#body#
</div>
</div>
</cfoutput>

layouts/default.cfm:
<cfoutput>
#view('navigation/main')#
#body#
</cfoutput>

Layouts cascade so the section-specific layout is applied, then the
site-wide layout is applied to that.
--
Sean A Corfield -- (904) 302-SEAN
Railo Technologies US -- http://getrailo.com/
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

Timothy Heald

unread,
Feb 25, 2010, 10:30:03 PM2/25/10
to framew...@googlegroups.com
I'm using a file in views/nav called buildNav.cfm then do view() to pull it
in and it dynamically builds my left side nav based on permissions and
section.

You can call services() as needed through the api in view templates.

Hey folks!

Thanks!

--
You received this message because you are subscribed to the Google Groups
"framework-one" group.
To post to this group, send email to framew...@googlegroups.com.
To unsubscribe from this group, send email to
framework-on...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/framework-one?hl=en.

Reply all
Reply to author
Forward
0 new messages