Дома на сервере Apache работает меню, а на другом платном не работает, принцип работы php меню: наводишь на ссылку открывается под меню и все. Скрипт кода ниже:
или скачать приклепленный файл меню!
index.php:
<?php
require_once('menu.php');
require_once('mymenu.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251">
</head>
<body>
<TR>
<TD COLSPAN=2 background="images/bg2.gif">
<div style="padding-left:20;padding-top:12;padding-bottom:2"><?php $main->show(); ?></div> </TD>
</TR> и т.д.
</body>
</html>
menu.php
<?php
class menu {
var $image;
var $items;
var $open;
var $closed;
var $indent;
var $name;
function menu($image,
$name,
$open = '',
$closed = '',
$indent = ''
)
{
$this->items = array();
$this->image = $image;
$this->name = $name;
$this->open = $open;
$this->closed = $closed;
$this->indent = $indent;
}
function add($image, $href = "", $target = "") {
$n = count($this->items);
if (is_object($image)) {
$this->items[$n] = $image;
} else {
$this->items[$n]['image'] = $image;
$this->items[$n]['href'] = $href;
$this->items[$n]['target'] = $target;
}
}
function show($nest = 0) {
$urlimage = strtr ($this->name, ' ', '_');
$indent = '';
global $$urlimage;
global $PHP_SELF;
global $QUERY_STRING;
if ($nest) { // > php4
if(function_exists("str_repeat")){
$indent = str_repeat($this->indent, $nest);
} else { // php3
for($i=0; $i<$nest; $i++){
$indent = $indent . $this->indent;
}
}
}
if (isset($$urlimage)) {
printf('%s<a href="%s?%s">%s</a><br>',
$indent . $this->open,
basename ($PHP_SELF),
ereg_replace("{$urlimage}=&", '', $QUERY_STRING),
$this->image);
echo "n";
while (list(,$item) = each($this->items)) {
if (is_object($item)) {
$item->show($nest + 1);
} else {
printf('%s<a href="%s"%s>%s</a><br>',
$indent . $this->indent,
$item['href'],
(!empty($item['target']) ? ' target="' . $item['target'] . '"' : ''), $item['image']);
echo "n";
}
}
} else {
printf('%s<a href="%s?%s=&%s">%s</a><br>',
$indent . $this->closed,
basename ($PHP_SELF),
$urlimage, $QUERY_STRING,
$this->image);
echo "n";
}
}
}
?>
mymenu.php
<?php
$main = new menu('<a href="index.php?menu_1=&">Главная</a>', 'menu 1');
//$main->add('<img src="images/1.gif" width="40" height="1">submenu', "page1.php?$QUERY_STRING", '_self');
//$main->add('<img src="images/1.gif" width="40" height="1">submenu', "page2.php?$QUERY_STRING", '_self');
//$main->add('<img src="images/1.gif" width="40" height="1">submenu', "page3.php?$QUERY_STRING", '_self');
$main2 = new menu('МАМАК', 'menu 2');
$main2->add('<tr><td><img src="images/bg3-1.gif" width="40" height="1">');
$main2->add('<img src="images/bg3-1.gif" width="40" height="11">Об ассоциации', "page1.php?$QUERY_STRING", '_self');
$main2->add('<img src="images/bg3-1.gif" width="40" height="11">Основные цели', "page2.php?$QUERY_STRING", '_self');
$main2->add('<img src="images/bg3-1.gif" width="40" height="11">Основные задачи', "page3.php?$QUERY_STRING", '_self');
и т.д.
?>
Скачать файл:
me.rarСкачан раз: 366