Solved

Coldfusion recursive categories fetching loop from Database!

Posted on 2014-04-06
2
519 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

746 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

11 Experts available now in Live!

Get 1:1 Help Now