VBAjedi
Posts: 34
|
Posted: 02/12/2004, 11:19 AM |
|
Not the best subject line, but the best I could think of. . .
The following HTML contains a Javascript (which in turn contains four sections of PHP code) that creates a popup menu structure dynamically from a MySQL table. It works correctly when put into a simple html file (outside of CCS). It also works if pasted into the HTML view of a blank CCS page IF I point my browser to TestPage.html instead of TestPage.php .
However, the goal is to put this menu on an includable page so I can put it at the top of every page on my site under the Header include. As near as I can tell, that means I need to be able to load TestPage.php. Currently when I attempt to do so, I get an error on the line with the first PHP tag inside the Javascript.
What do I need to do to integrate this code with CCS? Do the four PHP sections need to be moved to somewhere on the "Code" tab in CCS?
Thanks, and here's the code:
<html>
<head>
</head>
<body>
<?
$dbhost = "localhost"; // DB Host name
$dbusername = "root"; // DB User
$dbpass = "mypassword"; // DB User password
$dbname = "testDBase"; // DB Name
$query = "select * from menucategories";
$connection = mysql_connect($dbhost, $dbusername, $dbpass);
$resultCat = mysql_db_query($dbname, $query);
$numrowsCat = mysql_num_rows($resultCat);
?>
<script type="text/javascript" language="JavaScript1.2" src="./Menus/stm31.js"></script>
<script type="text/javascript" language="JavaScript1.2">
<!--
stm_bm(["menu10e2",400,"./Menus/","blank.gif",0,"","",0,0,250,0,1000,1,0,0,"","",0],this);
stm_bp("p0",[1,4,0,0,2,3,0,7,100,"",-2,"",-2,50,0,0,"#fffff7","#fffff7","",3,1,1,"#000000"]) ;
<?
for ($i = 0; $i < $numrowsCat; $i++)
{
$rowCat = mysql_fetch_array($resultCat);
$CatName = $rowCat["cat_name"];
?>
stm_ai("p0i0",[1,"<?=$CatName?> ","","",-1,-1,0,"","_self","","","","",0,0,0,"arrow_r.gif","arrow_r.gif",7,7,0,0,1,"#fffff7",0,"#b5bed6",0,"","",3,3,1,1,"#fffff7","#000000","#000000","#000000","8pt Verdana","8pt Verdana",0,0]);
stm_bpx("p1","p0",[1,2,0,0,2,3,0,0]);
<?
$queryPro = "select * from menuitems where CID=".$rowCat["CID"];
$resultPro = mysql_db_query($dbname, $queryPro);
$numrowsPro = mysql_num_rows($resultPro);
for ($j = 0; $j<$numrowsPro; $j++)
{
$rowPro = mysql_fetch_array($resultPro);
$ProName = $rowPro["display_text"];
$Link = $rowPro["link_string"];
?>
stm_ai("p1i0",[1,"<?=$ProName?> ","","",-1,-1,0,"<?=$Link?>","_self","","","","",0,0,0,"","",0,0,0,0,1,"#fffff7",0,"#b5bed6",0,"","",3,3,1,1,"#fffff7","#000000","#000000","#000000","8pt Verdana","8pt Verdana",0,0]);
<?
}
?>
stm_ep();
<?
}
?>
stm_ep();
stm_em();
//-->
</script>
</body>
</html>
_________________
VBAjedi
jedi at NOSPAM dot obie dot com |