struct references if you're on CFMX.
I'm not sure about the scope of all your variables, so I can't give you
specific solutions, but here are some ideas to get you started.
evaluate("request.arnav#request.subnav#")
is the same as this
request["arnav#request.subnav#"]
evaluate("#thissection#[LinkDetail][1]")
is the same as this (assuming the variable name stored in 'thissection' is
in the 'variables' scope)
variables[thissection]["linkDetail"][1]
cheers,
barneyb
-----Original Message-----
From: Shannon Rhodes [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 23, 2003 2:28 PM
To: CF-Talk
Subject: Dynamic Nav and evaluate()
I'm building dynamic site navigation and I'm concerned about processing
speed. I'm trying to break a bad habit by eliminating my use of
evaluate(),
but I just can't seem to figure out how to work around it.
Here's what I have:
*Variables are initialized in globals.cfm, called from application.cfm;
among these are a series of two-dimensional arrays for each major section
(primary nav) of the site. These arrays contain the primary section's
sub-navigation, i.e. the absolute link and the display label. I also have
a
separate array which keeps track of which directories should be considered
part of which section. Another array defines the primary (left) nav
links/labels. The _javascript_ text is also created, for the rollovers.
*In application.cfm, I figure out the directory I'm currently in, and then
figure out which section that directory belongs to. Then I set any
variables specific to that section (for example, META tags).
*I build the left-nav by looping through my primary nav array, checking
each
time to see if the current index is the section that I'm currently in (so
I
know whether or not to loop through the sub-nav).
*The sub-nav is where I get stuck. I have to use a dynamic variable to
figure out which array to call based on the section I'm in
("Request.ARNav"
& Request.SubNav). Next thing you know, I'm using evaluate() like crazy:
<CFLOOP INDEX="LinkDetail" FROM="1"
TO="#ArrayLen(evaluate("Request.ARNav#Request.SubNav#"))#">
<cfif cgi.script_name does not contain
'#evaluate("#ThisSection#[LinkDetail][1]")#'>
<a href=""> #evaluate("#ThisSection#[LinkDetail][2]")#</a>
<cfelse>
&##8594; #evaluate("#ThisSection#[LinkDetail][2]")#
</cfif>
</CFLOOP>
It works, but it's ugly and I haven't tested download time yet (it's fine
on
my dsl but who knows on dial-up), but I'm really afraid that between this
and all the image files for our new design, and all the various sections
of
my site that depend on dynamic content, I'm going to be looking at a
slooow
site. I'm starting to think that maybe this is one of those cases where I
should have stopped trying to code everything and just created a cfinclude
nav file for each separate section of the site with the sub-nav hard-coded
in, but then I wouldn't have the luxury of formatting my current page's
nav
option differently, which provides a nice visual rep of where you are.
Any
thoughts/advice? Sorry for the long post. Thanks!
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

