Cheers
Dave
<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>
<ahref="#request.self#?fuseaction=#getMenus.circuitname#.content&cmid=#cmi d# " onMouseOut="MM_swapImgRestore(); self.status=''; return true;"
onMouseOver="MM_swapImage('section#menuid#','','images/site_gfx/arrow_re
d.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>At 16:04 7/23/2003 +0100, you wrote:
Dave no attachments on the dev list -- Repost content in the email
-----Original Message----- From: Dave Phipps [mailto:[EMAIL PROTECTED] Sent: 23 July 2003 15:59 To: ColdFusion User group Subject: [ cf-dev ] Revisit [ cf-dev ] Selective recurse - help!!
Hi,
I am still banging my head against a brick wall on this one. I have attached the file buildtree.cfm. If someone could take a look and tell me if there is any way to show/hide the output (lines 82-92) depending on where in the menu the user is currently located, see the url below for the display.
I really need to knock this on the head otherwise I have to come up with a way of getting 2nd level menus into a dropdown system. Why is dynamic navigation so hard to generate???!
Cheers
Dave
>Hi, > >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=7 2 >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=#cmi d# > " onMouseOut="MM_swapImgRestore(); self.status=''; return true;" > onMouseOver="MM_swapImage('section#menuid#','','images/site_gfx/arrow_re d.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]
--- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.502 / Virus Database: 300 - Release Date: 18/07/2003
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.502 / Virus Database: 300 - Release Date: 18/07/2003
-- ** 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]
-- ** 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]
