Solved

Coldfusion recursive categories fetching loop from Database!

Posted on 2014-04-06
2
530 Views
Last Modified: 2014-04-06
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
Comment
Question by:xeondxb
2 Comments
 
LVL 19

Accepted Solution

by:
erikTsomik earned 500 total points
ID: 39982046
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
 

Author Closing Comment

by:xeondxb
ID: 39982178
yes i was looking this thanks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now