Building a dynamic menu from a database
I've reached the critical point where I have to get another mind on this ... I have a CMS where I'm building the navigation and sitemap from a database, and it's just not coming out quite right. Does anyone have an example I could look at to see where perhaps I'm missing something? I have a table containing page structures, Each page has an ID. (Fieldname: RandID) Each page is owned by another page (The one higher in the hierarchy) (fieldname: OwnerID) Each page belongs to a section (that's the top page in the heirarchy, just under the home page). (Fieldname: SectionID = the RandID of the top page in that section) Each page can 'own' other pages, as many levels down as makes sense, so there is no fixed number of levels. What I need to do is build a series of nested unordered lists along the lines of: ul liHome page/li liSection 1 ul liSub page 1/li liSub page 2 ul liSub sub page 1/li liSub sub page 2/li /ul /li liSub page 3/li /ul /li li Section 2 etc etc etc It's the correct markup of the nested unordered lists that's giving me trouble. Every time I think I've got it right, I find I haven't. There are nested loops and queries and CFC calls, and I think i might have tried to get so clever I've bamboozled myself. g -- Cheers Mke Kear Windsor, NSW, Australia Certified Advanced ColdFusion Developer AFP Webworks http://afpwebworks.com ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216152 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Building a dynamic menu from a database
Dunno if this helps mike, but Interakt has a DW extension for it. Free trial I believe. http://www.interaktonline.com/Products/Free-Products/MXTreeMenu/Overview/ Will ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216156 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Building a dynamic menu from a database
If using Oracle you could use the START WITH / CONNECT BY functions to get the ordered list. If it's just for display, you could use LPAD with LEVEL to pad the children. SELECT LABEL, SECTION_ID, TITLE, PARENT_ID, DESCR, TESTPLAN_ID, LPAD(LABEL,LENGTH(LABEL) + LEVEL,' ') AS DALABEL, LEVEL FROM TESTPLAN_SECTIONS ts WHERE testplan_id = cfqueryparam cfsqltype=cf_sql_numeric value=#url.tpid# / START WITH parent_id = 0 CONNECT BY PRIOR section_id = parent_id ORDER SIBLINGS BY LABEL On 8/24/05, Will Tomlinson [EMAIL PROTECTED] wrote: Dunno if this helps mike, but Interakt has a DW extension for it. Free trial I believe. http://www.interaktonline.com/Products/Free-Products/MXTreeMenu/Overview/ Will ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216159 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54