SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Norway
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    dynamic menu php/mysql + javascript

    Hello!!

    I've asked about dynmic menus before..I received a link to a good dynamic menu.(Sliding menu)

    But i want my menu to be created from a mysql database...

    Something like this: Items with parentID=0 --> top level in menu
    and so on..

    I've tried for weeks..

    Grateful for help..

    Here is the script I started from, i have removed some code.


    <script>
    slideMenu = new createSlideMenu("slideMenu")

    //Needed dummy classes
    slideMenu.bgClass = "slideMenuBG"
    slideMenu.txtClass = "slideMenuText"

    slideMenu.level[1] = new slideMenu_makeLevel(10,130,20,2,"clSlideMenu1","clA1","level1_regular.gif","level1_round2.gif","level1_round.gif","level1_sub.gif", "level1_sub_round.gif")
    slideMenu.level[2] = new slideMenu_makeLevel(20,120,18,2,"clSlideMenu2","clA2","level2_regular.gif","level2_round2.gif","level2_round.gif", "level2_sub.gif", "level2_sub_round.gif")
    slideMenu.level[3] = new slideMenu_makeLevel(30,110,20,2,"clSlideMenu3","clA3","level3_regular.gif","level3_round2.gif","level3_round.gif","level3_sub.gif","level3_sub_round.gif")
    slideMenu.level[4] = new slideMenu_makeLevel(40,100,19,2,"clSlideMenu4","clA4","level4_regular.gif", "level4_round2.gif","level4_round.gif","level4_sub.gif", "level4_sub_round.gif")


    for(var i=0;i<slideMenu.level;i++){
    var l = slideMenu.level[i]
    new preLoadBackgrounds(l.regImage,l.roundImg,l.roundImg2,l.subImg,l.subRound)
    }



    //Menu 1
    slideMenu.makeMenu('top','News')
    slideMenu.makeMenu('sub','sub_0','')
    slideMenu.makeMenu('sub2','sub2_1','')
    slideMenu.makeMenu('sub3','sub3_0')
    slideMenu.makeMenu('sub3','sub3_1')
    slideMenu.makeMenu('sub4','sub4_0')
    slideMenu.makeMenu('sub4','sub4_1')
    slideMenu.makeMenu('sub4','sub4_2')
    slideMenu.makeMenu('sub3','sub3_3')
    slideMenu.makeMenu('sub4','sub4_0')
    slideMenu.makeMenu('sub4','sub4_1')
    slideMenu.makeMenu('sub4','sub4_2')
    slideMenu.makeMenu('sub2','sub2_2')
    slideMenu.makeMenu('sub2','sub2_3')
    slideMenu.makeMenu('sub2','sub2_4')
    slideMenu.makeMenu('sub3','sub3_0')
    slideMenu.makeMenu('sub3','sub3_1')

    slideMenu.makeMenu('sub','sub_1','')
    slideMenu.makeMenu('sub','sub_2','')

    slideMenu.makeMenu('sub','sub_3','')
    slideMenu.makeMenu('sub','Categories')

    slideMenu.makeMenu('top','Sport')

    slideMenu.makeMenu('sub','New scripts','/script/search.asp?new=1')
    slideMenu.makeMenu('sub','All scripts','/script/index.asp')
    slideMenu.makeMenu('sub','Categories')

    slideMenu.makeMenu('top','International')
    slideMenu.makeMenu('sub','New scripts','/script/search.asp?new=1')
    slideMenu.makeMenu('sub','All scripts','/script/index.asp')
    slideMenu.makeMenu('sub','Categories')
    slideMenu.makeMenu('top','Domestic')
    slideMenu.makeMenu('sub','New scripts','')
    slideMenu.makeMenu('sub2','Menu scripts','/script/search.asp?category=menu')
    slideMenu.makeMenu('sub2','Text scripts','/script/search.asp?category=text')

    slideMenu.init()

    </script>

  2. #2
    SitePoint Guru
    Join Date
    Aug 2001
    Location
    Amsterdam
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Read this article :

    http://www.sitepoint.com/article/1105

    It should help you along the way ... otherwise pm me I might have some code lying around somewhere
    the neigbours (free) WIFI makes it just a little more fun


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •