Quick ColdFusion Question

Quick ColdFusion Question, I’m helping someone with their real estate website, which uses CF and I am not familiar with CF at all so I was hoping someone could help.

Basically, below is most of the header and navigation:

On the Navigation, it’s set to change the class to “cur” based on whichever page you’re on. Simple enough right?

The only problem is, with the way the code is written, it sets the “Property Search” page to the current class any time it is on a page that is /idx.cfm. (Which are dynamically created pages)

So my thought, since I only have the issues in the 2 pages (code shown below), I could write a statement like:

IF Page Title IS “My Listings” set link class to “cur” or if URL, but it would need to pass the values after the question mark…

I’m not exactly sure what the best approach is… any ideas?

Code is below:


...
...
...

<div id="header" class="mod-con">
      <h1 id="logo"><a href="/index.cfm"><img src="/image/logo.png" alt="logo" /></a></h1>
        <cfset pageList="
        /index.cfm|Home,
       [B][COLOR="#B22222"] /idx.cfm|Property Search,
        /idx.cfm?action=frm.select-map&load=1&agent=true&listingSystem=austin&state=TX|My Listings,[/COLOR][/B]
        /exclusives/generic_officesearch.cfm|Featured Listings,
        /about.cfm|About,
        /contact.cfm|Contact
        ">
        <cfset loopct = 1>
         <ul id="main-menu">
		  <cfloop list="#pageList#" index="q">
		   <cfoutput>
		    <cfset thisLink=trim(listFirst(q, '|'))>
		    <cfset thisLinkText=trim(listLast(q,'|'))>
		     <li>
   		      <strong>[COLOR="#B22222"][B]<a href="#thisLink#"<cfif cgi.SCRIPT_NAME contains "#thisLink#"> class="cur"</cfif><cfif loopct eq 1><cfelseif loopCt eq listLen(pageList)></cfif>>
			  #thisLinkText#</a>[/B][/COLOR]</strong>
			 </li>
		  </cfoutput>
		   <cfset loopCt = loopCt + 1>
		</cfloop>
		</ul>
    </div>
...
...
...

May not be the most efficient way (or 100% syntactically correct), but I ended up figuring it out…


    <div id="header" class="mod-con">
      <h1 id="logo"><a href="/index.cfm"><img src="/image/logo.png" alt="logo" /></a></h1>
         <cfset pageList="
        /index.cfm|Home,
        /idx.cfm|Property Search,
        /idx.cfm?action=frm.select-map&load=1&agent=true&listingSystem=austin&state=TX|My Listings,
        /exclusives/generic_officesearch.cfm|Featured Listings,
        /about.cfm|About,
        /contact.cfm|Contact
        ">
        <cfset loopct = 1>
         <ul id="main-menu">
		  <cfloop list="#pageList#" index="q">
		   <cfoutput>
		    <cfset thisLink=trim(listFirst(q, '|'))>
		    <cfset thisLinkText=trim(listLast(q,'|'))>
		     <li>
   		      <strong>
   		        <a href="#thisLink#"
   		          <cfif cgi.SCRIPT_NAME contains "#thisLinkText#"> class="cur"</cfif>
   		          <cfif (not structKeyExists(url, 'agent') and #thisLink# contains '/idx.cfm' and #thisLinkText# contains 'Property Search')> class="cur"</cfif>
   		          <cfif (structKeyExists(url, 'agent') and trim(url.agent) eq "true") and #thisLinkText# eq 'My Listings'> class="cur"</cfif>
   		          <cfelseif loopCt eq listLen(pageList)></cfif>>
			  #thisLinkText#</a></strong>
			 </li>
		  </cfoutput>
		   <cfset loopCt = loopCt + 1>
		</cfloop>
		</ul>
    </div>