Cold Fusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingCold Fusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 28th, 2007, 05:25 AM
richardgroen richardgroen is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 1 richardgroen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 48 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old March 12th, 2008, 11:49 PM
hexeliebe hexeliebe is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 5 hexeliebe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 38 sec
Reputation Power: 0
Quote:
Originally Posted by richardgroen
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.


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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingCold Fusion Development > Dynamic menu. How to?


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap