SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Evangelist cturner01's Avatar
    Join Date
    Jun 2006
    Location
    My computer
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    The right page links for each menu isn't working

    I am trying to display javascript menus using php. Most of my code displays as javascript code however displaying the right page links for each menu, isn't working for me. For example the javascript code should look like this: mm_menu_1.addMenuItem("BDGP BOARD","location='page.php?page=BDGP+Board'");. So can someone please have a look at my code and tell how I can achieve the above? Thanks in advance.

    Here is my code:
    Code PHP:
    $query = mysql_query("SELECT menuname, pagetitle, menuid FROM menu LEFT JOIN pages ON menu.menuname = pages.menuid") or die ("Could not query because: ".mysql_error());
     
    echo '<script type="text/javascript">';
    echo "\nfunction mmLoadMenus() {\n";
    while($row=mysql_fetch_assoc($query)) {
     
    $add_menu_item = "addMenuItem(".$row['pagetitle'].",location=page.php?page=".$row['pagetitle'].")";
    $menu_id = "mm_menu_".$row['menuid'];
    echo "if (window.".$menu_id.") return;\n";
    echo "window.".$menu_id." = new Menu(\"root\",142,20,\"Verdana, Arial, Helvetica, sans-serif\",10,\"#ffffff\",\"#ffffff\",\"#00397a\",\"#0046c2\",left\",middle\",3,0,1000,-5,7,true,false,true,0,true,true);\n";
    echo $menu_id.".".$add_menu_item.";\n";
    echo $menu_id."."."hideOnMouseOut=true;\n";
    echo $menu_id."."."menuBorder=0;\n";
    echo $menu_id."."."menuItemBorder=0;\n";
    echo $menu_id."."."menuLiteBgColor=\'#ffffff\';\n";
    echo $menu_id."."."menuBorderBgColor=\'#555555\';\n";
    echo $menu_id."."."bgColor=\'#555555\';\n\n";
     
    echo $menu_id.".writeMenus();\n\n";
    }
    echo "}\n";
    echo '</script>';

  2. #2
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you sure that menu.menuname = pages.menuid ?
    try this:
    Code:
    select menu.menuid, menu.menuname, menu.pagetitle
      from menu
    left outer
      join pages
        on menu.menuid = pages.menuid
    Quote Originally Posted by Rudy Limeback
    An OUTER join returns all rows from one table, plus matching rows, if any, based on the join condition, from the other table
    read
    my mobile portal
    ghiris.ro


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
  •