Hallo
Ich habe eine einfaches Navigations script (horizontal) in php gefunden, welches ich nicht anwenden kann. Obwohlich die url hineinschreibe,
z.B.
$opts['Item1'] = $_SERVER['home/home.php'];
komme ich nicht aud die verlinkte Seite.
Was mache ich falsch?
----------------------------------------------
SCRIPT
----------------------------------------------
<?php
/*
+--------------------------------------------------+
| Author: Allan Irvine <ai@ayrsoft.com> |
+--------------------------------------------------+
| Date: WED 11 DEC 2002 |
+--------------------------------------------------+
| Origin: Scotland, United kingdom |
+--------------------------------------------------+
| Script: FREE_MENU_CLASS.php |
+--------------------------------------------------+
| No License |
| free to use for personal and commercial purposes |
+--------------------------------------------------+
*/
class hover_menu{
// define the menu colors
var $font_on = "white"; // on hover font color
var $font_off = "black"; // normal font color
var $cell_on = "#9999CC"; // on hover cell color
var $cell_off = "#CCCCFF"; // normal cell color
var $border_color = "black"; // menu border color
function print_menu($name,$array,$horizon){
// start a php session
session_start();
// apply some style for the hyperlinks
$RTN.= "<style type=\"text/css\">\n";
$RTN.= "a.".$name."\n{color:".$this->font_off.";\nfont-family:Verdana,Arial,Helvetica;";
$RTN.= "\nfont-size:10;\ntext-decoration:none;\n}\n";
$RTN.= "a.".$name.":hover\n{\ncolor:".$this->font_on.";\nfont-family:Verdana,Arial,Helvetica; ";
$RTN.= " \nfont-size:10;\ntext-decoration:underline;\n}\n";
$RTN.= "</style>\n";
// register the menu name as a session variable
if ($_GET[$name]){
$_SESSION[$name] = $_GET[$name];
}elseif($_POST[$name]){
$_SESSION[$name] = $_POST[$name];
}
$RTN.= "<table cellpadding=2 cellspacing=1 border=0 bgcolor=".$this->border_color.">\n";
if (isset($horizon)){
$RTN.= "<tr>\n";
} else {
$OTR = "<TR>\n";
$CTR = "</TR>\n";
}
while(list($key,$val)=each($array)){
if ($key==$_SESSION[$name]){
$Cell_sel = $this->cell_on;
unset($mouseover);
}else{
$Cell_sel = $this->cell_off;
$mouseover = " onmouseover=\"this.style.background='".$this->cell_on."';\" ";
$mouseover.= " onmouseout=\"this.style.background='".$this->cell_off."';\" ";
}
$cell = "valign=\"middle\" align=\"center\" bgcolor=".$Cell_sel;
$RTN .= $OTR."<td ".$cell.$mouseover."><a href=".$val."?".$name."=".urlencode($key)." class=".$name.">".$key."</a></td>".$CTR."\n";
}
if (isset($horizon)){
$RTN.= "</tr>\n";
}
$RTN.= "</table>\n";
return $RTN;
}
}
/*
+------------------------+
| EXAMPLES BELOW |
+------------------------+
| test material below |
| just remove all the |
| garbage below when you |
| are done |
+------------------------+
*/
echo "<body bgcolor=white>\n";
$opts['Item One'] = $_SERVER['PHP_SELF'];
$opts['Item Two'] = $_SERVER['PHP_SELF'];
$opts['Item Three'] = $_SERVER['PHP_SELF'];
$opts['Item Four'] = $_SERVER['PHP_SELF'];
$opts['Item Five'] = $_SERVER['PHP_SELF'];
$m = new hover_menu;
echo "<p>1. set the menu horizontal</p>\n";
echo $m->print_menu("allan",$opts,1);
unset($opts);
$opts['Item1'] = $_SERVER['PHP_SELF'];
$opts['Item2'] = $_SERVER['PHP_SELF'];
$opts['Item3'] = $_SERVER['PHP_SELF'];
$opts['Item4'] = $_SERVER['PHP_SELF'];
$opts['Item5'] = $_SERVER['PHP_SELF'];
echo "<p>2. Or set the menu vertical</p>\n";
echo $m->print_menu("allanirvine",$opts);
?>
---------------------------------------------------
Ich danke für eine Tipp
Grüsse
Jessica
Ich habe eine einfaches Navigations script (horizontal) in php gefunden, welches ich nicht anwenden kann. Obwohlich die url hineinschreibe,
z.B.
$opts['Item1'] = $_SERVER['home/home.php'];
komme ich nicht aud die verlinkte Seite.
Was mache ich falsch?
----------------------------------------------
SCRIPT
----------------------------------------------
<?php
/*
+--------------------------------------------------+
| Author: Allan Irvine <ai@ayrsoft.com> |
+--------------------------------------------------+
| Date: WED 11 DEC 2002 |
+--------------------------------------------------+
| Origin: Scotland, United kingdom |
+--------------------------------------------------+
| Script: FREE_MENU_CLASS.php |
+--------------------------------------------------+
| No License |
| free to use for personal and commercial purposes |
+--------------------------------------------------+
*/
class hover_menu{
// define the menu colors
var $font_on = "white"; // on hover font color
var $font_off = "black"; // normal font color
var $cell_on = "#9999CC"; // on hover cell color
var $cell_off = "#CCCCFF"; // normal cell color
var $border_color = "black"; // menu border color
function print_menu($name,$array,$horizon){
// start a php session
session_start();
// apply some style for the hyperlinks
$RTN.= "<style type=\"text/css\">\n";
$RTN.= "a.".$name."\n{color:".$this->font_off.";\nfont-family:Verdana,Arial,Helvetica;";
$RTN.= "\nfont-size:10;\ntext-decoration:none;\n}\n";
$RTN.= "a.".$name.":hover\n{\ncolor:".$this->font_on.";\nfont-family:Verdana,Arial,Helvetica; ";
$RTN.= " \nfont-size:10;\ntext-decoration:underline;\n}\n";
$RTN.= "</style>\n";
// register the menu name as a session variable
if ($_GET[$name]){
$_SESSION[$name] = $_GET[$name];
}elseif($_POST[$name]){
$_SESSION[$name] = $_POST[$name];
}
$RTN.= "<table cellpadding=2 cellspacing=1 border=0 bgcolor=".$this->border_color.">\n";
if (isset($horizon)){
$RTN.= "<tr>\n";
} else {
$OTR = "<TR>\n";
$CTR = "</TR>\n";
}
while(list($key,$val)=each($array)){
if ($key==$_SESSION[$name]){
$Cell_sel = $this->cell_on;
unset($mouseover);
}else{
$Cell_sel = $this->cell_off;
$mouseover = " onmouseover=\"this.style.background='".$this->cell_on."';\" ";
$mouseover.= " onmouseout=\"this.style.background='".$this->cell_off."';\" ";
}
$cell = "valign=\"middle\" align=\"center\" bgcolor=".$Cell_sel;
$RTN .= $OTR."<td ".$cell.$mouseover."><a href=".$val."?".$name."=".urlencode($key)." class=".$name.">".$key."</a></td>".$CTR."\n";
}
if (isset($horizon)){
$RTN.= "</tr>\n";
}
$RTN.= "</table>\n";
return $RTN;
}
}
/*
+------------------------+
| EXAMPLES BELOW |
+------------------------+
| test material below |
| just remove all the |
| garbage below when you |
| are done |
+------------------------+
*/
echo "<body bgcolor=white>\n";
$opts['Item One'] = $_SERVER['PHP_SELF'];
$opts['Item Two'] = $_SERVER['PHP_SELF'];
$opts['Item Three'] = $_SERVER['PHP_SELF'];
$opts['Item Four'] = $_SERVER['PHP_SELF'];
$opts['Item Five'] = $_SERVER['PHP_SELF'];
$m = new hover_menu;
echo "<p>1. set the menu horizontal</p>\n";
echo $m->print_menu("allan",$opts,1);
unset($opts);
$opts['Item1'] = $_SERVER['PHP_SELF'];
$opts['Item2'] = $_SERVER['PHP_SELF'];
$opts['Item3'] = $_SERVER['PHP_SELF'];
$opts['Item4'] = $_SERVER['PHP_SELF'];
$opts['Item5'] = $_SERVER['PHP_SELF'];
echo "<p>2. Or set the menu vertical</p>\n";
echo $m->print_menu("allanirvine",$opts);
?>
---------------------------------------------------
Ich danke für eine Tipp
Grüsse
Jessica
Kommentar