NetTalk Central

Author Topic: Dynamic Menu -- Newbie  (Read 4583 times)

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Dynamic Menu -- Newbie
« on: December 27, 2007, 03:24:10 PM »
Is there a way to load a menu's options based on classifications in the database?  I'd like to utilize this menu:  http://www.stunicholls.com/menu/pro_dropdown_2.html#nogo34

The Classifcations Table is the parent table.  If there are no child records, then I either want to leave that classification out of the menu, or disable it. 

Is it likely that this would bog things down a lot?  (I realize that this depends on the number of classifications.)

Thank you,

Jim

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: Dynamic Menu -- Newbie
« Reply #1 on: December 29, 2007, 02:13:38 PM »
Wow. Nice menu.
I have altered some things to use the Sucker Fish menus with some very nice results so I don't see why you couldn't use these.

In your page header procedure, just loop through your classification parent - child records to create the list structure.

Start with
packet = '<span class="preload1"></span>'&|
               '<span class="preload2"></span>' &|
                '<ul id="nav">'
do sendpacket
outside the loop

set(parent)
loop
      parent.next()
       if parent is done then break.
       packet = '<li class="top"><a href="' & clip(parent:href)&'" class="top_link"><span>Home</span></a>'       
      if child records exist
           packet = clip(packet)& '<ul class="sub">'
           loop
             child.next()
              if child is done then break.
              packet=clip(packet)& '<li><a href="'&clip(child:href)&' ">'&clip(child.menutext) &'</a></li> '
           end
           packet = clip(packet)& '</ul>' !close the list of children
      end
      packet = clip(packet) & '</ li>'   !close the parent
end
do sendpacket

... or something similar.

HTH,
chris c


Real programmers use copy con newapp.exe

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Re: Dynamic Menu -- Newbie
« Reply #2 on: January 18, 2008, 08:29:18 AM »
Hi Chris:  Been away from the project for a bit.  Just now found your  reply and help.  I will give it a try.

Many thanks,

Jim