oops, I forgot to var a variable and I modified the function to reduce
the number of empty ul's

<cffunction name="generate_list" output="true" >
        <cfargument name="parentID" required="true"/>
        
        <cfset var list_items = "" />
                
        <cfquery name="list_items" dbtype="query">
        SELECT          sID,pID,sort,display,link
        FROM            joeTest
        WHERE           pId = #parentid#
        ORDER BY        sort asc
        </cfquery>
        
        <cfif list_items.recordcount gt 0>
        <cfloop query="list_items">
                <cfif list_items.currentrow eq 1><ul></cfif>
                <cfoutput><li>#display#</li></cfoutput>
                <cfset generate_list(sID)/>
                <cfif list_items.currentrow eq 
list_items.recordcount></ul></cfif>
        </cfloop>
        
        </cfif>
        
</cffunction>


On 9/27/06, Marlon Moyer <[EMAIL PROTECTED]> wrote:
Methinks Joe is getting awfully cheap consultant work here :)

Sorry, I tried to put it all on one line, but gmail kept on inserting breaks. :(

This was tested against bluedragon, but I don't think it will have a
problem with 6.1 or above

<cfquery datasource="whatever" name="joeTest">
SELECT          sID,pID,sort,display,link
FROM            yourtablehere
</cfquery>

<cfset parentid = 0/>

<cffunction name="generate_list" >
        <cfargument name="parentID" required="true"/>

        <cfquery name="list_items" dbtype="query">
        SELECT          sID,pID,sort,display,link
        FROM            joeTest
        WHERE           pId = #parentid#
        ORDER BY        sort asc
        </cfquery>

        <cfloop query="list_items">
                <ul>
                <cfoutput><li>#display#</li></cfoutput>
                <cfset generate_list(sID)/>
                </ul>
        </cfloop>


</cffunction>

<cfset generate_list(0)>


On 9/27/06, Joe Kelly <[EMAIL PROTECTED]> wrote:
> Got another one for you....
>
> Given: attached parent/child table (txt or mdb)
> Wanted: a cf generated heirarchal nested list with list items under
> their respective parents
> Requirements: none, if you use components, keep them all in one cfc
> for ease of reading. The nesting could be unlimited.
>
> Results should look something like the following:
>
> Home
> [EMAIL PROTECTED]
>       Project Manager Development
>             Open Projects
>             Close Projects
>       Applications
>       Workgroups
>             Current Workgroups
>             Historical Workgroups
>             General Information
>       Social Side of Work
> Resources
> etc.....
>
> Good luck!
> Thanks,
> Joe Kelly
>
>
> _______________________________________________
> Reply to DFWCFUG:
>   [email protected]
> Subscribe/Unsubscribe:
>   http://lists1.safesecureweb.com/mailman/listinfo/list
> List Archives:
>     http://www.mail-archive.com/list%40list.dfwcfug.org/
>   http://www.mail-archive.com/list%40dfwcfug.org/
> DFWCFUG Sponsors:
>   www.HostMySite.com
>   www.teksystems.com/
>
>
>
>


--
Marlon



--
Marlon

_______________________________________________
Reply to DFWCFUG: [email protected] Subscribe/Unsubscribe: http://lists1.safesecureweb.com/mailman/listinfo/list List Archives: http://www.mail-archive.com/list%40list.dfwcfug.org/ http://www.mail-archive.com/list%40dfwcfug.org/ DFWCFUG Sponsors: www.HostMySite.com www.teksystems.com/

Reply via email to