Gallo, Paul wrote:
Jeff Coughlin mentioned a few months ago that he has written a fix to
the sitemap webskin file to make it valid XHTML...  Was this code ever
released to the list?  Was it stored anywhere after the problems with
the daemon site?

Alright. I had to strip-down the version I was using (lots of custom code to determine when to display cerain <ul> ids and <il> classes). The file (attached) is thus much smaller and seems to work great. As always, once you're ready for production it is highly suggested to turn on caching (you can unremark the commented code lines at the top and bottom of the file).

There is one thing I should note. In my original version I was using a custom getDescendants() (called getValidDescendants()) that would not return nodes that didn't have valid content to display. This is very handy because it allows me to organize nodes of content under common (empty) nodes. If you'd like a copy of this custom method let me know, otherwise just use the standard getDescendants() that comes with the Farcry core.

-Jeff C.
<cfsetting enablecfoutputonly="yes" />

<cfimport taglib="/farcry/farcry_core/tags/webskin" prefix="skin" />

<!--- <skin:cache hours="6" cachename="_SiteMap" cacheBlockName="Content" /> 
--->

<cfscript>
  // get navigation elements
  navFilter=arrayNew(1);
  navfilter[1]="status IN (#listQualify(request.mode.lvalidstatus, "'")#)";
  qNavLocations = 
application.factory.oTree.getDescendants(objectid=application.navid.home, 
depth=1, afilter=navFilter, lColumns='lNavIDAlias');
</cfscript>

<cfloop query="qNavLocations">
  <cfscript>
    // get navigation elements
    navFilter=arrayNew(1);
    navfilter[1]="status IN (#listQualify(request.mode.lvalidstatus, "'")#)";
    qNav = 
application.factory.oTree.getDescendants(objectid=qNavLocations.objectID, 
depth=999, afilter=navFilter, lColumns='lNavIDAlias');
    lv0 = listFirst(listSort(valueList(qNav.nlevel),"numeric","asc")); //sort 
the value list and grab the first value as nlevel for plateau
    depth = listLast(listSort(valueList(qNav.nlevel),"numeric","asc")); // sort 
the value list and grab the first value as the default depth ie. plateau
  </cfscript>

   <!--- Create Nav Menu --->
   <cfset numberOld = lv0 />
   <cfset numberOriginal = numberOld />
     <!--- Declare loop variables --->
     <cfset navMenu = '' />
     <cfset numberCurrent = '' />

   <cfsavecontent variable="NavMenu">
     <cfloop query="qNav">
       <cfset numberCurrent = qNav.nLevel />
       <cfif numberCurrent gt numberOld>
         <cfif currentrow neq 1>
           <cfoutput><ul><li></cfoutput>
         <cfelse>
           <cfoutput><ul><li></cfoutput>
         </cfif>
       <cfelseif numberCurrent lt numberOld>
         <cfloop index="j" from="1" 
to="#numberOld-numberCurrent#"><cfoutput></li></ul></cfoutput></cfloop>
         <cfoutput></li><li></cfoutput>
       <cfelse><!--- numbers are the same --->
         <cfif currentrow neq 1>
           <cfoutput></li><li></cfoutput>
         <cfelse>
           <cfoutput><ul><li></cfoutput>
         </cfif>
       </cfif>
       <skin:buildlink 
objectid="#qNav.objectid#"><cfoutput>#application.oCustomFunctions.XmlFormat2(trim(qNav.objectname))#</cfoutput></skin:buildLink>
       <cfif qNav.recordCount eq currentrow>
         <cfloop index="k" from="1" 
to="#numberCurrent-numberOriginal#"><cfoutput></li></ul></cfoutput></cfloop>
       </cfif>
       <cfset numberOld = numberCurrent />
     </cfloop>
   </cfsavecontent>

   <cfoutput>#NavMenu#</cfoutput>
</cfloop>

<!--- </skin:cache> --->

<cfsetting enablecfoutputonly="no" />
---
You are currently subscribed to farcry-dev as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to