 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

December 21st, 2004, 11:00 PM
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
dynamically generated submenus
I already created a site that has dynamically driven menus...and it works perfectly - now I need to add on the ability to have nested or sub menus on some of the items if necessary (determined dynamically ... if the category in the database has a sub categroy...) My question is, is this possible, How would I go about accomplishing this - any ideas....
elladi
|

December 22nd, 2004, 04:36 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi elladi,
Yes, you can, but you'll have a hard time building it. The code that DW generates may not be too easy to understand.
I think the easiest way to do it (and how I have done it in the past), is to create a static menu with sub menus with Dreamweaver first. Then look at the code, figure out what you need to change to make it dynamic and leave the rest of the code as is. You'll get in big troubles otherwise... ;)
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|

December 22nd, 2004, 08:52 AM
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I looked at the code and am encountering two problems maybe you can help me....first of all it seems to create the submenues before creating the root menus - is the order necessary because that would cause me a problem with processing....also the second isssue is generating the numbers dynamically for the submenus - how do I figure out what numbers to use for the submenu - when I wont know what they are supposed to be ???
Thanks
|

December 22nd, 2004, 09:01 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Didn't we do this back in July?? http://p2p.wrox.com/topic.asp?TOPIC_ID=16773
Did you check out this thread: http://p2p.wrox.com/topic.asp?TOPIC_ID=6623
The numbers you see are the current date and time (the date and time you inserted the menu in the page in Dreamweaver). You can invent your own naming scheme as long as related stuff uses the same number / id.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Filigree and Shadow by This Mortal Coil (Track 15 from the album: Filigree and Shadow) What's This?
|

December 22nd, 2004, 10:29 AM
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ok - but does the order matter can I create the root menus before the subs???
Adina
|

December 22nd, 2004, 10:44 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
If you create your own identifiers you can generate them in any order, I think (haven't tested it, though), as long as you add them to the final HTML in the correct order.
You could save the menu code to local variables before you write them out to the page.
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Waiting Waiting by Kane (Track 8 from the album: As Long As You Want This) What's This?
|

December 22nd, 2004, 11:07 AM
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
OK - I get it - one thing though if I loop through and create a string with the commands to create the root menu (while I am taking care of the sub menus...) how do I get in Javascript to take that string and process it like a list of commands???
elladi
|

December 22nd, 2004, 01:56 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You need to save the submenus and root menus in local *asp* variables. Then when you're done building the menus, use Response.Write to dump the menu code in the page. Then it will end up as regular JavaScript code (just like the DW menus) so it will execute when the page loads.
Does this help??
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Hyperspeed (G-Force Part 2) by Prodigy (Track 5 from the album: Experience) What's This?
|

December 23rd, 2004, 11:19 AM
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
quick question I am working on putting the commands into a string - but I am running in to quotation issues....naybe you can help - I want to put this:
mm_menu_womens_0.addMenuItem(mm_menu_womens_0_<%=o rs("category_id")%>
,"location='categoryind.asp?categoryid=<%=ors("cat egory_id")%>'");
into the variable roomenulist....how do I break it up to take care of all the quotations....
thanks
|

December 24th, 2004, 08:12 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Answered here: http://p2p.wrox.com/topic.asp?TOPIC_ID=23969
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: I Am The Highway by Audioslave (Track 8 from the album: Audioslave) What's This?
|
|
 |