I am just starting PHP (as in today). I want to create a customizable menu using a jquery script that can have a variable amount of items.
I am getting an error when i run this. The error is:
Ayrıştırma hatası: 5. satırdaki / home/s0urc3/public_html/files01/menu.php sözdizimi hatası, beklenmedik T_VARIABLE
Onun cevabını için Chase strong> sayesinde
index.php:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<?PHP
$script_url="http://files01.s0urc3.ismywebsite.com/jquery/nagging-menu/nagging-menu.js";
$menu_css="http://files01.s0urc3.ismywebsite.com/jquery/nagging-menu/style.css";
$links = array(
array("url" => "http://www.something1.com", "label" => "something"),
array("url" => "http://www.something2.com", "label" => "something2"),
array("url" => "http://www.something3.com", "label" => "something3"),
);
include("menu.php");
?>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
<title></title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href=".css"/>
</head>
<body>
<?=writeMenu($links, $menu_css, $script_url)?>
</body>
</html>
menu.php:
<?
function writeMenu($links, $script_url, $menu_css){
$menu = '<link href=\"$menu_css\" type=\"text/css\">'
$menu = '<div id="navi">';
$menu .= '<div id="menu" class="default">';
$menu .= '<ul>';
foreach ($links as $item) {
$menu .= "<li><a href=\"".$item['url']."\">".$item['label']."</a></li>";
}
$menu .= "</ul>";
$menu .= "</div>";
$menu .= "<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js\" charset=\"utf-8\"></script>";
$menu .= "<script type=\"text/javascript\" src=$script_url charset=\"utf-8\"></script>";
return $menu;
}
?>
Onun Re-script için Chase için teşekkürler