Op deze website gebruiken we cookies om content en advertenties te personaliseren, om functies voor social media te bieden en om ons websiteverkeer te analyseren. Ook delen we informatie over uw gebruik van onze site met onze partners voor social media, adverteren en analyse. Deze partners kunnen deze gegevens combineren met andere informatie die u aan ze heeft verstrekt of die ze hebben verzameld op basis van uw gebruik van hun services. Meer informatie.

Akkoord

Vraag & Antwoord

Webprogrammeren & scripting

CoolMenus4 in combinatie met PHP/MySQL

de_paashaas
3 antwoorden
  • Hallo,

    Ik ben bezig met het bouwen van een dynamisch menu met de bovenstaande combinatie. Het is bijna voormekaar, op een paar bugs na, welke ik maar niet gefixed krijg.

    Als ik met de muis over de items 'Mediconsult' en 'Kwaliteit van zorg' ga, krijg ik een JavaScript-error:

    ('Mediconsult':)
    [code:1:5e72cf45b1]
    Regel: 236
    Teken: 35
    Fout: 'o' is leeg of geen object
    Code: 0
    [/code:1:5e72cf45b1]

    ('Kwaliteit van zorg':)
    [code:1:5e72cf45b1]
    Regel: 217
    Teken: 7
    Fout: 'o.x' is leeg of geen object
    Code: 0
    [/code:1:5e72cf45b1]

    Eveneens raar:
    Alle menuitems worden keurig netjes uit de database getrokken en geordend (zie de HTML-sourcecode), maar er zijn een aantal items die niet als menuitem verschijnen. Ook duikt er om de zoveel keer een rechthoekig grijs veld op in de hoek linksboven. Het zaal waarschijnlijk wel met de bovenstaande errors te maken hebben.

    Het is te testen op:
    http://www.mediconsult.nl/www-new/

    Heeft iemand enig idee?
    Bij voorbaat bedankt,



    Hier volgt het stuk PHP code:
    [code:1:5e72cf45b1]
    <?php


    // Copyright (c) Interakt Online 2001
    // http://www.interakt.ro/

    require("./adodb/adodb.inc.php");
    require("./Connections/Medicon.php");
    ?><?php
    session_start();

    $KT_numRows_Rs_menu_forest = -1
    ?><?php
    $Rs_menu_forest = $Medicon->Execute("SELECT * FROM public_content where content_type='forest' ORDER BY content_id ASC") or KT_DIE($Medicon->ErrorNo(),$Medicon->ErrorMsg());
    $Rs_menu_forest_numRows=0;
    $Rs_menu_forest__totalRows=$Rs_menu_forest->RecordCount();
    ?><?php
    if ($content_id==NULL)
    {
    $content_id="1";
    }
    ?><?php
    $Rs_content = $Medicon->Execute("SELECT * FROM public_content where content_id='$content_id'") or KT_DIE($Medicon->ErrorNo(),$Medicon->ErrorMsg());
    $Rs_content_numRows=0;
    $Rs_content__totalRows=$Rs_content->RecordCount();
    ?><?php
    $brochure=$Rs_content->Fields("brochure");
    $content_type_check=$Rs_content->Fields("content_type");
    $quote_check=$Rs_content->Fields("quote");
    ?><?php
    $Rs_brochure = $Medicon->Execute("SELECT * FROM brochures where title='$brochure'") or KT_DIE($Medicon->ErrorNo(),$Medicon->ErrorMsg());
    $Rs_brochure_numRows=0;
    $Rs_brochure__totalRows=$Rs_brochure->RecordCount();
    ?><?php
    $Rs_quote = $Medicon->Execute("SELECT * FROM quotes where title='$quote_check'") or KT_DIE($Medicon->ErrorNo(),$Medicon->ErrorMsg());
    $Rs_quote_numRows=0;
    $Rs_quote__totalRows=$Rs_quote->RecordCount();
    ?><?php
    $Rs_jumpmenu = $Medicon->Execute("SELECT * FROM public_content where forest_connection='Behandelingen' AND content_type='branch' ORDER BY title ASC") or KT_DIE($Medicon->ErrorNo(),$Medicon->ErrorMsg());
    $Rs_jumpmenu_numRows=0;
    $Rs_jumpmenu__totalRows=$Rs_jumpmenu->RecordCount();
    ?><?php
    $Repeat1__numRows = -1;
    $Repeat1__index= 0;
    $Rs_menu_forest_numRows = $Rs_menu_forest_numRows + $Repeat1__numRows;
    ?><?php
    $Repeat2__numRows = -1;
    $Repeat2__index= 0;
    $Rs_menu_tree_numRows = $Rs_menu_tree_numRows + $Repeat2__numRows;
    ?>
    <html>
    <head>
    <title>Mediconsult.nl :: Kliniek voor estetisch-plastische-chirurgie</title>
    <script language="JavaScript1.2" src="js/coolmenus4.js"></script>
    <script language="JavaScript1.2" src="js/cm_addins.js"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" href="css/style_public.css" type="text/css">
    <style>
    .clCMEvent{position:absolute; z-index:300; width:100%; height:100%; clip:rect(0,100%,100%,0); left:0; top:0; visibility:hidden}
    .clCMAbs{position:absolute; width:10; height:10; left:0; top:0; visibility:hidden}

    .menuForest,.menuForestover,.menuTree,.menuTreeover,.menuBranch,.menuBranchover{position:absolute; overflow:hidden; width:130; height:25; cursor:pointer; cursor:hand}
    .menuForestover{padding:4px; font-size:9px; font-weight:bold}
    .menuForest{color:white; ; font-family: Verdana, Arial, Helvetica, sans-serif}
    .menuForestover{color:#FFFFFF;; font-family: Verdana, Arial, Helvetica, sans-serif}
    .menuTree{padding:2px; font-size:9px; font-weight:normal; font-family: Verdana, Arial, Helvetica, sans-serif}
    .menuBranch,.menuBranchover{padding:2px; font-size:11px;}
    .menuBranch{color:#006699; background-color:#CDDBEB; layer-background-color:#CDDBEB;}
    .menuBranchover{color:#FCCE55;}
    .clB,.clBar{layer-background-color:#336699; background-color:#336699;}
    .clB{visibility:hidden; z-index:300; width:150; height:20}
    .clBar{width:10; height:10; visibility:hidden; }
    .menuForest { padding:4px; font-size:9px; font-weight:bold ; background-color: #9DAE7A} .menuTreeover { font-family: Verdana, Arial, Helvetica, sans-serif }.menuTreeover { padding:2px; font-size:9px; font-weight:normal} .menuTreeover { color:#FFFFFF; } .menuForestover { layer-background-color:#336699; background-color:#093A80; } .menuTree2over { layer-background-color:#336699; background-color:093A80; } .menuTreeover { layer-background-color:#336699; background-color:#093A80; } .menuTree { color:#093A80; background-color:#CDDBEB; layer-background-color:#CDDBEB; } </style>
    <script language="JavaScript">
    <!–
    <!–
    function MM_reloadPage(init) { /
    eloads the window if Nav4 resized
    if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
    else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
    }
    MM_reloadPage(true);

    function MM_jumpMenu(targ,selObj,restore){ //v3.0
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    if (restore) selObj.selectedIndex=0;
    }
    // –>

    //–>
    </script>
    </head>
    <body bgcolor="#CAE09C" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <script>
    /***
    This is the menu creation code - place it right after you body tag
    Feel free to add this to a stand-alone js file and link it to your page.
    **/

    //Menu object creation
    oCMenu=new makeCM("oCMenu") //Making the menu object. Argument: menuname

    //Menu properties
    oCMenu.pxBetween=0
    oCMenu.fromLeft=11
    oCMenu.fromTop=103
    oCMenu.rows=1
    oCMenu.menuPlacement="left"

    oCMenu.offlineRoot="file:///C|Inetpub/wwwroot/dhtmlcentral/"
    oCMenu.onlineRoot="http://www.mediconsult.nl/www-new/"
    oCMenu.resizeCheck=1
    oCMenu.wait=1000
    oCMenu.fillImg="cm_fill.gif"
    oCMenu.zIndex=0

    //Background bar properties
    oCMenu.useBar=0
    oCMenu.barWidth="100%"
    oCMenu.barHeight="menu"
    oCMenu.barClass="clBar"
    oCMenu.barX=0
    oCMenu.barY=0
    oCMenu.barBorderX=0
    oCMenu.barBorderY=0
    oCMenu.barBorderClass=""

    //Level properties - ALL properties have to be specified in level 0
    oCMenu.level[0]=new cm_makeLevel() //Add this for each new level
    oCMenu.level[0].width=0
    oCMenu.level[0].height=19
    oCMenu.level[0].regClass="menuForest"
    oCMenu.level[0].overClass="menuForestover"
    oCMenu.level[0].borderX=0
    oCMenu.level[0].borderY=0
    oCMenu.level[0].borderClass="menuForestover"
    oCMenu.level[0].offsetX=0
    oCMenu.level[0].offsetY=20
    oCMenu.level[0].rows=0
    oCMenu.level[0].arrow=0
    oCMenu.level[0].arrowWidth=0
    oCMenu.level[0].arrowHeight=0
    oCMenu.level[0].align="center"

    //EXAMPLE SUB LEVEL[1] PR- You have to specify the properties you want different from LEVEL[0] - If you want all items to look the same just remove this
    oCMenu.level[1]=new cm_makeLevel() //Add this for each new level (adding one to the number)
    oCMenu.level[1].width=oCMenu.level[0].width-2
    oCMenu.level[1].height=20
    oCMenu.level[1].regClass="menuTree"
    oCMenu.level[1].overClass="menuTreeover"
    oCMenu.level[1].borderX=0
    oCMenu.level[1].borderY=0
    oCMenu.level[1].align="right"
    oCMenu.level[1].offsetX=-(oCMenu.level[0].width-2)/2+20
    oCMenu.level[1].offsetY=0
    oCMenu.level[1].borderClass="menuTreeover"


    /******************************************
    Menu item creation:
    myCoolMenu.makeMenu(name, parent_name, text, link, target, width, height, regImage, overImage, regClass, overClass , align, rows, nolink, onclick, onmouseover, onmouseout)
    *************************************/

    <?php while (($Repeat1__numRows– != 0) && (!$Rs_menu_forest->EOF))
    {
    $forest_title=$Rs_menu_forest->Fields("title");
    $forest_id=$Rs_menu_forest->Fields("content_id");
    $forest_title2=str_replace(" ", "", "$forest_title");
    $forest_title3=strtolower($forest_title2);
    $forest_sqlconn=$Rs_menu_forest->Fields("forest_connection");
    $forest_connection=str_replace(" ", "", "$forest_conn");

    $forest_length1=strlen($forest_title)*8;

    if ($forest_length1>64)
    {
    $forest_length2=$forest_length1*0.23;
    $forest_length=$forest_length1-$forest_length2;
    }
    else
    {
    $forest_length=strlen($forest_title)*8;
    }

    echo "oCMenu.makeMenu('$forest_title3','$forest_title3','$forest_title','index.php?content_id=$forest_id','','$forest_length')
    ";

    $Rs_menu_tree = $Medicon->Execute("SELECT * FROM public_content WHERE content_type = 'tree' AND forest_connection='$forest_sqlconn' ORDER BY title ASC") or KT_DIE($Medicon->ErrorNo(),$Medicon->ErrorMsg());
    $Rs_menu_tree_numRows=0;
    $Rs_menu_tree__totalRows=$Rs_menu_tree->RecordCount();

    while (($Repeat2__numRows– != 0) && (!$Rs_menu_tree->EOF))
    {
    $tree_title=$Rs_menu_tree->Fields("title");
    $tree_title2=str_replace(" ", "", "$tree_title");
    $tree_title3=strtolower($tree_title2);
    $forest_conn2=$Rs_menu_tree->Fields("forest_connection");
    $forest_connection2=str_replace(" ", "", "$forest_conn2");
    $tree_id=$Rs_menu_tree->Fields("content_id");
    $tree_length=strlen($tree_title)*7;

    if ($tree_length>150)
    {
    $tree_height="38";
    $tree_length=$forest_length;
    }
    elseif ($tree_length>300)
    {
    $tree_height="57";
    $tree_length=$forest_length;
    }
    else
    {
    $tree_height="19";
    $tree_length=$forest_length;
    }
    echo "oCMenu.makeMenu('$tree_title3','$forest_title3','$tree_title - $tree_length','index.php?content_id=$tree_id','','150','$tree_height')
    ";

    $Repeat2__index++;
    $Rs_menu_tree->MoveNext();
    }

    $Repeat1__index++;
    $Rs_menu_forest->MoveNext();
    }
    ?>

    //Leave this line - it constructs the menu
    oCMenu.construct()
    </script>
    [/code:1:5e72cf45b1][size=9:5e72cf45b1][/size:5e72cf45b1][size=7:5e72cf45b1][/size:5e72cf45b1][size=9:5e72cf45b1][/size:5e72cf45b1]
  • Bij mij werkt het perfect hoor.
  • Bij mij niet. Op zich werken de links wel maar als ik naar beneden scroll dan komt het menu terug op de absolute plaatst op het scherm. Dus midden in de tekst. Lijkt me niet de bedoeling….


    gr,

    JeePeeS

    [/img]

Beantwoord deze vraag

Dit is een gearchiveerde pagina. Antwoorden is niet meer mogelijk.