• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 575
  • Last Modified:

Coldfusion recursive categories fetching loop from Database!

When im running this script it is printing all my categories. i want when level change <UL> if tag should enable.

i know my logic is wrong looking that's why looking you help....

Please find below my query output Screen Shoot

<cfset catLevel = 0>

<ul id="menu">

<cfset getQuery = getAllCategories()>
<cfloop query="getQuery">

<cfif #getQuery.level# GT #catLevel#>
	<ul>
    <!--Sub-Category -->
</cfif>

	<li>
    
    	<a href="http://www.link.com/">
			<cfoutput>#Name#</cfoutput>
        </a>
        
	</li>

<cfif  #getQuery.level# GT #catLevel#>
	</ul>
    <!--Sub-Category -->
</cfif>
	
    	
   			 <cfset catLevel = #getQuery.level#>

    </cfloop>
	
    
</ul>

Open in new window

queryOut.jpg
0
xeondxb
Asked:
xeondxb
1 Solution
 
erikTsomikSystem Architect, CF programmer Commented:
take a look at this example I think that is exactly what you are looking for

http://www.dougboude.com/blog/1/2006/06/Recursive-Functions-in-ColdFusion.cfm
0
 
xeondxbAuthor Commented:
yes i was looking this thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now