I am using a recursive tag to generate some navigation links. The table structure for the menus is set up in a parent/child relationship with menus have a parentmenuid equal to the parent menuid or 0 if it is a parent. The recursive tag grabs the menu then checks for children then calls itself to check if each child has any children etc.
We have one section of the site with a large number of menus and it looks pretty ugly. What I want to do is only show the children of the select parent.
The url to view is: http://new.abingdon.org.uk/index.cfm?fuseaction=academic.content&cmid=72
The site is not yet live but needs to be sorted asap.
What I want to happen with the menu: When you arrive to the Academic section you should just see the top level menus (parents) then clicking on Departments will move to another page with the departments listed. When a specific department is clicked then the children of this department will be seen.
If anyone could spare a few moments to take a look and see if there is a way to alter the tag to do the above that would be great. Is there a better way to do this navigation?
The code for the tag is below:
<cfsilent>
<cfparam name="theid" default="0">
<cfparam name="mode" default="outline">
<cfparam name="indent" default="0">
<cfparam name="attributes.circuitname" default="">
<cfif IsDefined("attributes.indent")>
<cfset indent = attributes.indent>
</cfif>
<cfif IsDefined("attributes.theid")>
<cfset theID = attributes.theid>
</cfif>
<cfif IsDefined("attributes.mode")>
<cfset mode = attributes.mode>
</cfif>
<cfparam name="attributes.showAll" default="false">
<cfquery datasource="#request.dsn#" name="getMenus" dbtype="ODBC">
SELECT circuits.circuitname, menus.menuid, menus.circuitid, menus.menuname, menus.parentmenuid, menus.displayorder, contentManager.cmid
FROM circuits, menus, contentManager, content
WHERE parentmenuid = #theid#
AND content.onMenu = 1
<cfif attributes.showAll EQ false>AND content.isApproved = 1</cfif>
AND contentManager.contentid = content.contentid
AND contentManager.menuid = menus.menuid
AND circuits.circuitid = menus.circuitid
AND circuits.circuitname = '#attributes.circuitname#'
ORDER BY menus.displayorder, menuid, parentmenuid
</cfquery>
</cfsilent>
<cfloop query="getMenus">
<cfset thisid = getMenus.cmid>
<cfoutput>
<span class="navbar" style="margin-left:#indent#px;">
<cfif attributes.cmid EQ thisid OR (IsDefined("caller.getFirstPage.recordcount") AND caller.getFirstPage.cmid EQ thisid)>
<img src="images/site_gfx/arrow_blue.gif" border="0" name="section#menuid#"><span style="color:##7C8AA2;">#menuname#</span>
<cfelse>
<a href="#request.self#?fuseaction=#getMenus.circuitname#.content&cmid=#cmid#" onMouseOut="MM_swapImgRestore(); self.status=''; return true;" onMouseOver="MM_swapImage('section#menuid#','','images/site_gfx/arrow_red.gif',1); self.status='#Replace(menuname, "'", "", "ALL")#'; return true;"><img src="images/site_gfx/arrow_black.gif" border="0" name="section#menuid#">#menuname#</a>
</cfif>
</span><br>
</cfoutput>
<cfquery datasource="#request.dsn#" cachedwithin="#CreateTimeSpan(0,0,0,2)#" name="checkForChild" dbtype="ODBC">
SELECT menuid
FROM menus
WHERE parentmenuid = #getMenus.menuid#
</cfquery>
<cfif checkForChild.RecordCount gt 0>
<cfset nextindent = indent + 10>
<cfif attributes.showAll EQ true>
<cfset attributes.showAll = true>
</cfif>
<cf_buildtree theid = "#getMenus.menuid#" mode = "#mode#" indent="#nextindent#" circuitname="#attributes.circuitname#" cmid="#attributes.cmid#" showAll="#attributes.showAll#">
</cfif>
</cfloop>
-- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]
