Wrox Programmer Forums
|
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
 
Old December 21st, 2004, 11:00 PM
Authorized User
 
Join Date: Jul 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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


 
Old December 22nd, 2004, 04:36 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
 
Old December 22nd, 2004, 08:52 AM
Authorized User
 
Join Date: Jul 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old December 22nd, 2004, 09:01 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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?
 
Old December 22nd, 2004, 10:29 AM
Authorized User
 
Join Date: Jul 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok - but does the order matter can I create the root menus before the subs???

Adina

 
Old December 22nd, 2004, 10:44 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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?
 
Old December 22nd, 2004, 11:07 AM
Authorized User
 
Join Date: Jul 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old December 22nd, 2004, 01:56 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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?
 
Old December 23rd, 2004, 11:19 AM
Authorized User
 
Join Date: Jul 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old December 24th, 2004, 08:12 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamically generated dropdownlist csun ASP.NET 1.0 and 1.1 Basics 3 April 8th, 2008 07:38 AM
How to store the dynamically generated controls ? ramesh1520 ASP.NET 2.0 Basics 0 January 2nd, 2008 10:30 PM
dynamically generated form SaraJaneQ Javascript How-To 4 November 9th, 2006 11:11 AM
Dynamically generated textboxes and their values Frode ASP.NET 2.0 Basics 1 April 17th, 2006 03:46 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.