<?php
/*
==============================================================
This script is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Copyright (c) 2000 Pierre Marceau. You may freely use
and redistribute under the terms of the GNU General Public
License.
--------------------------------------------------------------
Class basicmenu - http://www.skynet.ca/~pierre/
Written on May 14, 2000, under PHP 4.0 RC1 ModPHP and IE 5.0.
Tested NN 4.6 and PHP 3.14 Win2000 IIS 5.0 ... ok.
Comments, suggestions and bug reports welcome!
==============================================================
*/
class basicmenu {
var $mylinks=array();
var $myfontsize = "12";
var $mySearchFieldSize = "3";
var $mymenuwidth = "100";
var $mycolor = "white";
var $myactivecolor = "yellow";
var $mybgcolor = "green";
var $mystartpage = "/";
function menu(){
echo
"<html>\n",
"<head>\n",
"<style type=\"text/css\">\n",
"<!--\n",
"body {\n",
"font-family: Arial, Helvetica, sans-serif;\n",
"background: $this->mybgcolor;\n",
"}\n",
"a {\n",
"font-size: $this->myfontsize"."pt;\n",
"color: $this->mycolor;\n",
"text-decoration: none;\n",
"}\n",
"a:active {\n",
"color: $this->myactivecolor;\n",
"}\n",
"-->\n",
"</style>\n",
"<title>\n",
"Menu\n",
"</title>\n",
"</head>\n",
"<body bgcolor=\"$this->mybgcolor\" link=\"$this->mycolor\" alink=\"$this->myactivecolor\" vlink=\"$this->mycolor\">\n",
"<nobr>\n<font point-size=\"$this->myfontsize\">\n";
while (list($label,$value)=each($this->mylinks)) {
if (eregi("^line.?$",$label)) {
echo "<hr>\n";
}elseif (eregi("^SEARCH$",$label)) {
$this->search($value);
}else{
echo "<a href=\"$value\" target=\"display\">${label}</a><br>\n";
}
}
echo "</font>\n</nobr>\n</body>\n</html>\n";
}
function myframebody() {
global $PHP_SELF;
echo
"<html>\n",
"<head>\n",
"<title>\n",
" Menu\n",
"</title>\n",
"</head>\n",
"<frameset cols=\"$this->mymenuwidth,*\">\n",
" <frame src=\"$PHP_SELF?mode=menu\" name=\"menu\" frameborder=\"0\" scrolling=\"no\">\n",
" <frame src=\"";
echo $this->mystartpage;
echo "\" name=\"display\" frameborder=\"0\">\n",
"</frameset>\n",
"</html>\n";
}
function search($mySearchURL) {
echo
"<form method=\"post\" action=\"$mySearchURL\" target=\"display\">\n",
"<a>Search:</a><br>\n",
"<input name=\"bmquery\" size=\"$this->mySearchFieldSize\">\n",
"</form>\n";
}
function main() {
global $mode;
switch (true) {
case ($mode=="menu") : $this->menu(); return;
case (empty($mode)) : $this->myframebody(); return;
default : echo "Error: Should never get this far! \$mode = $mode";
return;
}
}
}
?>
|