|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Dynamic menu. How to?
I am looking for a dynamic menu for my website but i cant figure out how.
I want to have a menu like this: (horizontally aligned) 1Start 2Information 3Contact 1about us 2contact form 3address 1company 2flyers 3email The 'Start', 'Information' and 'Contact' items are the headmenu items. The about us, contact form etc are the submenu items I have a relational database with two tables. In one I have the headmenu items and the second one the submenu items. In the submenu table i have a ID reference to the headmenu id so these two can be linked. <!--- variables of the get_headmenu are #headmenuname# This is the title of the headmenu ---> <cfquery name="get_headmenu" datasource="#dsn#"> Select * from tbl_headmenu </cfquery> <!--- the submenu name variable is #submenuname# ---> <cfquery name="get_submenu" datasource="#dsn#"> Select * from tbl_submenu where tbl_headmenuid = #get_headmenu.id# </cfquery> The two queries must be added together in order to create a dynamic menu. Can somebody help me please? Thanks, Richard. |
|
#2
|
|||
|
|||
|
Quote:
This is more of a SQL question than one for CF, although the solution will require you to do an external and internal loop using group to get the right layout. here is the sql. <cfquery name="getMenu" datasource="#dsn#"> Select h.item[1] AS headID ,h.itme[2] AS head ,s.item[1] AS Sub ,s.item[2] AS sheadid--foreign key to headid from tbl_headmenu h LEFT JOIN tbl_submenu s ON s.[headMenu]id = h.id order by h.item[1],s.item[1] </cfquery> This will give you a list of header menus and their associated subs then you output like this. <cfoutput query=getMenu group='h.item[1]'> #head <cfloop > <cfif sheadid eq headid> <cfoutput>#sub#</cfoutput><BR> </cfif> </cfloop> </cfoutput> you'll have to play with it for a bit since it's been about five years since I programmed like this but with no more information this is the easiest way to get it accomplished. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Cold Fusion Development > Dynamic menu. How to? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|