Ok - This "should" be an easy one. But my brain is stuck... For my Content management system I built - I use Dynamic popup menus Based on "Prather Productions" dynamic menus.
I have a query go and get all the pages in the site - and then I loop through it to find pages associated to pages - - and on and on. To be honest, I know it's not the most efficient thing, as I wrote it early on when I was first learning CF - but it works. And somtimes if it aint broke - don't try to fix it. Well - Now I need to change the Background of EACH level of the Menu - so that it produces a rainbow effect on the bottuns as it goes down. So - I setup another Table in the DB that has the different graphics for the background and the Order it should be in. So - I essentially have 2 Loops. One for Colors, and one for the menu - but everytime I combine them I get "Lots" of duplicate rows - or all one color. Code to follow - Thans for the help! test Site: http://cf.bigfatdesigns.com/clients/roto/index.cfm -nick -code- <!--- Get The Colors ---> <cfquery name="qryGetMenuBG" datasource="#datasource#" username="#username#" password="#password#"> SELECT * FROM MenuBackground ORDER by MBSort </cfquery> <!--- Get The menu ---> <cfquery name="qryGetAllMenu" datasource="#datasource#" username="#username#" password="#password#"> SELECT Content.PageID, Content.Title, Content.AssocID, Content.Sort FROM Content WHERE Content.AssocID = '0' AND Content.Active=1 ORDER BY Sort ASC </cfquery> <cfquery name="qryGetSubPages" datasource="#datasource#" username="#username#" password="#password#"> SELECT Content.PageID, Content.Title, Content.AssocID, Content.Sort FROM Content WHERE Content.AssocID <> '0' AND Content.Active=1 ORDER BY Sort, AssocID ASC </cfquery> <script type="text/javascript" language="JavaScript1.2"> <!-- stm_bm(["ivvnair",400,"","media/images/clear.gif",0,"","",0,0,0,0,50,1,0,0,""],this); stm_bp("p0",[2,4,5,0,1,5,5,7,100,"#E7D8B9",-2,"#E7D8B9",-2,90,0,0,"#33302C","#FFFFFF","",3,0,0,""]); stm_ai("p0i0",[0,"About Us ","","",-1,-1,0,"index.cfm","_parent","","","","",0,0,0,"","",0,0,0,0,1,"#E7D8B9",0,"#DC5813",0,"<cfoutput>media/images/#qryGetMenuBG.MBFile#</cfoutput>","",3,3,0,0,"#E7D8B9","#E7D8B9","#FFFFFF","#FFFFFF","8pt Arial","8pt Arial",0,0]); <!-- Get Layer 1 Menu <cfloop query="qryGetAllMenu"> <cfoutput> <cfquery name="qryCheckPageID" dbtype="query" username="#username#" password="#password#"> SELECT PageID, Title, AssocID FROM qryGetSubPages WHERE #qryGetAllMenu.PageID# = AssocID ORDER BY Sort ASC </cfquery> <!-- Print Layer 1 Menu <cfif qryCheckPageID.recordcount GTE 1> stm_ai("p0i0",[0,"#qryGetAllMenu.Title# ","","",-1,-1,0,"index.cfm","_parent","","","","",0,0,0,"","",0,0,0,0,1,"##E7D8B9",0,"##DC5813",0,"media/images/#qryGetMenuBG.MBFile#","",3,3,0,0,"##E7D8B9","##E7D8B9","##FFFFFF","##FFFFFF","8pt Arial","8pt Arial",0,0]); stm_bpx("p1","p0",[1,2,0,0,0,3,5,7,100,"progid:DXImageTransform.Microsoft.Iris(irisStyle=SQUARE,motion=out,enabled=0,Duration=0.25)",1,"",-2,60]); <!-- Loop through Menu <cfloop query="qryCheckPageID"> <!-- See if Page has any pages associated with it <cfquery name="qryGetAllSubs" datasource="#datasource#" username="#username#" password="#password#"> SELECT Content.PageID, Content.Title, Content.AssocID, Content.Sort FROM Content WHERE Content.AssocID = #qryCheckPageID.PageID# AND Content.Active = 1 ORDER BY Sort ASC </cfquery> <!-- If it does show an arrow <cfif qryGetAllSubs.recordcount GTE 1> stm_aix("p1i0","p0i0",[0,"#qryCheckPageID.Title# ","","",-1,-1,0,"interior_page.cfm?PageID=#qryCheckPageID.PageID#","_parent","","","","",0,0,0,"media/images/arrow_right.gif","media/images/arrow_white_right.gif",0,0,0,0,1,"##E7D8B9",0,"##939B95",0,"","",3,3,1,1,"##E7D8B9 ##E7D8B9 ##FFFFFF ##FFFFFF","##FFFFFF ##FFFFFF ##FFFFFF ##FFFFFF"]); <cfelse> <!-- If not - no arrow stm_aix("p1i0","p0i0",[0,"#qryCheckPageID.Title# ","","",-1,-1,0,"interior_page.cfm?PageID=#qryCheckPageID.PageID#","_parent","","","","",0,0,0,"","",0,0,0,0,1,"##E7D8B9",0,"##939B95",0,"","",3,3,1,1,"##E7D8B9 ##E7D8B9 ##FFFFFF ##FFFFFF","##FFFFFF ##FFFFFF ##FFFFFF ##FFFFFF"]); </cfif> <cfif qryGetAllSubs.recordcount GTE 1> <!-- If it does - Begin Layer 2 stm_bpx("p1","p0",[1,2,0,0,0,3,0,0,100,"progid:DXImageTransform.Microsoft.Iris(irisStyle=SQUARE,motion=out,enabled=0,Duration=0.20)",1,"",-2,60]); <!-- Loop through Menu Layer 2 <cfloop query="qryGetAllSubs"> <!-- See if Page has any pages associated with it <cfquery name="qryGetAllSubs2" datasource="#datasource#" username="#username#" password="#password#"> SELECT Content.PageID, Content.Title, Content.AssocID, Content.Sort FROM Content WHERE Content.AssocID = #qryGetAllSubs.PageID# AND Content.Active = 1 ORDER BY Sort ASC </cfquery> <!-- If it does show an arrow <cfif qryGetAllSubs2.recordcount GTE 1> stm_aix("p1i0","p0i0",[0,"#qryGetAllSubs.Title# ","","",-1,-1,0,"interior_page.cfm?PageID=#qryGetAllSubs.PageID#","_parent","","","","",0,0,0,"media/images/arrow_right.gif","media/images/arrow_white_right.gif",0,0,0,0,1,"##E7D8B9",0,"##939B95",0,"","",3,3,1,1,"##E7D8B9 ##E7D8B9 ##FFFFFF ##FFFFFF","##FFFFFF ##FFFFFF ##FFFFFF ##FFFFFF"]); <cfelse> <!-- If not - no arrow stm_aix("p1i0","p0i0",[0,"#qryGetAllSubs.Title# ","","",-1,-1,0,"interior_page.cfm?PageID=#qryGetAllSubs.PageID#","_parent","","","","",0,0,0,"","",0,0,0,0,1,"##E7D8B9",0,"##939B95",0,"","",3,3,1,1,"##E7D8B9 ##E7D8B9 ##FFFFFF ##FFFFFF","##FFFFFF ##FFFFFF ##FFFFFF ##FFFFFF"]); </cfif> <!-- If there is a sub menu - start layer 3 <cfif qryGetAllSubs2.recordcount GTE 1> stm_bpx("p1","p0",[1,2,0,0,0,3,0,0,100,"progid:DXImageTransform.Microsoft.Iris(irisStyle=SQUARE,motion=out,enabled=0,Duration=0.20)",1,"",-2,60]); <!-- loop Layer 3 <cfloop query="qryGetAllSubs2"> stm_aix("p1i1","p1i0",[0,"#qryGetAllSubs2.Title# ","","",-1,-1,0,"interior_page.cfm?PageID=#qryGetAllSubs2.PageID#","_parent","","","","",0,0,0,"","",0,0,0,0,1,"##E7D8B9",0,"##939B95",0,"","",3,3,1,1,"##E7D8B9 ##E7D8B9 ##FFFFFF ##FFFFFF","##FFFFFF ##FFFFFF ##FFFFFF ##FFFFFF"]); </cfloop> stm_ep(); </cfif> </cfloop> stm_ep(); </cfif> </cfloop> <cfelse> stm_aix("p0i1","p0i0",[0,"#qryGetAllMenu.Title# ","","",-1,-1,0,"interior_page.cfm?PageID=#PageID#","_parent","","","","",0,0,0,"media/images/clear.gif","media/images/clear.gif",7,7]); stm_bpx("p1","p0",[1,2,0,0,0,3,4,0,100,"progid:DXImageTransform.Microsoft.Iris(irisStyle=SQUARE,motion=out,enabled=0,Duration=0.25)",1,"",-2,60]); </cfif> stm_ep(); </cfoutput> </cfloop> stm_ep(); stm_ep(); stm_em(); //--> </script> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1730 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
