仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2151|回复: 19
打印 上一主题 下一主题

[学习教程] PHP网页编程之仿OfficeXP作风的右边版面列表

[复制链接]
分手快乐 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-2-16 00:27:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
学习了六个多月PHP了,还是个新手,在这里受到了很多人的帮助,谢谢你们!   <?php
/**
* 仿OfficeXP作风的右边版面列表
* --------------------------------------------------------------------------------
* blood 于 2/19/2002 4:47:11 PM 加贴在 Visual Basic
*
* 徐祖宁(絮聒) 移植于 3/2/2002
* OOP 版
*
*/

class Frame {
function run() {
global $PHP_SELF;
echo <<<EOD
<HTML>
<HEAD>
<TITLE>Menu Sample</TITLE>
<SCRIPT LANGUAGE="JavaScript">
if (window != top) top.location.href = location.href;
</SCRIPT>
</HEAD>
<FRAMESET cols="161,*">
<FRAME MARGINWIDTH="0" SRC="$PHP_SELF?key=menu" NAME="menu" SCROLLING=no NORESIZE>
<FRAME MARGINWIDTH="0" SRC="$PHP_SELF?key=about" NAME="main" scrolling=auto NORESIZE>
</FRAMESET>
</HTML>
EOD;
}
}

class About {
function run() {
echo <<<EOD
<style>
body { font-size: 9pt; font-family:"Verdana", "Arial", "宋体"; }
</style>
<body>
<center>
<br>
<br>
关于此菜单
<br>
<br>
申明,此菜单法式只能利用在IE 5以上的版本利用,NetSpace下不克不及利用,保举利用IE 6正式中文版
</center>
</body>
EOD;
}
}

class Page {
function run($id1) {
global $id;
echo <<<EOD
<style>
body { font-size: 9pt; font-family:"Verdana", "Arial", "宋体"; }
</style>
<body>
<center>
<br>
<br>
接待会见 $id
</center>
</body>
EOD;
}
}

class Menu {
var $MenuOn = 0; //界说分类菜双数目
var $MenuBackColor = "lightgrey"; //界说分类菜单后台色彩
var $MenuFontSize = "9pt"; //界说分类菜单字体
var $MenuBarHeight = 20; //界说分类菜单高度
var $ItemTextColor = "#000000"; //界说分类菜单项目文字色彩
var $ItemBackColor = "lightgrey"; //界说分类菜单项目后台色彩
var $TopMenuHeight = 0; //界说分类菜单与顶部的间距
var $SelectedItemDarkBorder = "#08246B"; //界说分类菜单项目在鼠标挪动到下面时的暗边框色彩
var $SelectedItemLightBorder = "#08246B"; //界说分类菜单项目在鼠标挪动到下面时的亮边框色彩
var $SelectedItemBackgroundColor = "#B5BED6"; //界说分类菜单项目在鼠标挪动到下面时的后台色彩
var $menuSubSectionBackColor = "darkgray"; //界说二级菜单后台色彩
var $menuSubSectionFontColor = "black"; //界说二级菜单菜单字体色彩
var $defTarget = "main"; //界说菜单项目超毗连默许方针框架

/**
* menuStartSection($Seq, $Label)
* 制造分类菜单
* $Seq = 分类菜单序列号,利用菜单序列号掌握启动是显示按次
* $Label = 分类菜单题目
*/
function menuStartSection($SectionSeq, $SectionName) {
$menuBackColor = $this->menuBackColor;
$MenuBarHeight = $this->MenuBarHeight;
$MenuFontSize = $this->MenuFontSize;
$menuSection = $this->menuSection;
$ItemBackColor = $this->ItemBackColor;
$mh = $this->MenuBarHeight-2;
echo <<<EOD

<table bgcolor="$menuBackColo" border=0 cellspacing=0 cellpadding=0 width="100%" height="1">
<tr height="1">
<td bgcolor="white"></td>
</tr>
</table>
<table bgcolor="$menuBackColor" border=1 cellspacing=0 cellpadding=0 bordercolor="$menuBackColor" width="100%" height="$mh">
<tr vAlign="center" height="100%">
<td nowrap border=3 width="100%" height="100%" bordercolordark=lightgrey bordercolorlight=lightgrey align=center style="cursor:hand;" title="$SectionName" onmou搜索引擎优化ver="status=’$SectionName’;" onmou搜索引擎优化ut="status=’’;" onclick="StartSection(menuSection$SectionSeq);">$SectionName</td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=0 width="100%" height="1">
<tr height="1">
<td bgcolor="Black"></td>
</tr>
</table>
<div name=menuSection$SectionSeq id=menuSection$SectionSeq style="display:’none’;overflow:hidden; height:1px;marginRight:0px;">
<table bgcolor=$ItemBackColor style="marginRight=0px;" border=1 cellspacing=0 cellpadding=0 bordercolor="$ItemBackColor" width="100%">
EOD;
}

/**
* menuAddItem($Label, $Description, $URL, $Target="")
* 制造菜单项目
* $Label = 项方针题
* $Description = 项目简介
* $URL = 超毗连地址
* $Target = 超毗连方针框架,默许为$defTarget
*/
function menuAddItem($itemLabel, $StatusText, $URL, $target="") {
$SelectedItemDarkBorder = $this->SelectedItemDarkBorder;
$SelectedItemLightBorder = $this->SelectedItemLightBorder;
$SelectedItemBackgroundColor = $this->SelectedItemBackgroundColor;
$ItemTextColor = $this->ItemTextColor;

if($target == "") $target = $this->defTarget;
$URL = $this->buildURL($URL);
echo <<<EOD

<tr>
<td width="100%" align=left style="cursor:hand;" title="$StatusText" onmou搜索引擎优化ver="this.borderColorDark=’$SelectedItemDarkBorder’;this.borderColorLight=’$SelectedItemLightBorder’;this.style.backgroundColor=’$SelectedItemBackgroundColor’;this.style.color=’black’;status=’$StatusText’;" onmou搜索引擎优化ut="this.borderColorDark=’’;this.borderColorLight=’’;this.style.backgroundColor=’’;status=’’;" onclick="window.open(’$URL’,’$target’);"><font color="$ItemTextColor">$itemLabel</font></td>
</tr>
EOD;
}

/**
* menuAddSubSection($Label)
* 制造二级分类菜单。
* $Label = 二级分类菜单题目
*/
function menuAddSubSection($ItemLabel) {
$menuSubSectionBackColor = $this->menuSubSectionBackColor;
$menuSubSectionFontColor = $this->menuSubSectionFontColor;
echo <<<EOD

<tr bgcolor="$menuSubSectionBackColor">
<td align=center width="100%"><font color="$menuSubSectionFontColor">$ItemLabel</font></td>
</tr>
EOD;
}

/**
* menuAddSubSectionLine()
* 制造项目朋分线,利用高度为2的图片
*/
function menuAddSubSectionLine() {
echo <<<EOD

<tr vAlign="center">
<td align=center width="100%" height="2" bgcolor="white">
<table border=0 cellspacing=0 cellpadding=0 width="100%" height="1">
<tr vAlign="center" height="2">
<td bgcolor="white"></td>
</tr>
</table>
</td>
</tr>
EOD;
}

/**
* menuEndSection()
* 分类菜单停止
*/
function menuEndSection() {
echo <<<EOD

</table>
</div>
EOD;
}

/**
* menuSectionAsItem($Label, $Description, $URL, $Target="")
* 制造带超毗连的分类菜单,相似菜单项目,可以直接利用
* $Label = 分类菜单题目
* $Description = 分类菜单简介
* $URL = 超毗连地址
* $Target = 超毗连方针框架,默许为$defTarget
*/
function menuSectionAsItem($SectionSeq, $SectionName, $SectionDesc, $URL, $target="") {
$menuBackColor = $this->menuBackColor;
$MenuBarHeight = $this->MenuBarHeight;

if($target == "") $target = $this->defTarget;
$URL = $this->buildURL($URL);
$mh = $this->MenuBarHeight-2;
echo <<<EOD

<table border=0 cellspacing=0 cellpadding=0 width="100%" height="1">
<tr vAlign="center" height="1">
<td bgcolor="white"></td>
</tr>
</table>
<table bgcolor="$menuBackColor" border=1 cellspacing=0 cellpadding=0 bordercolor="$menuBackColor" width="100%" height="Smh">
<tr height="100%" vAlign="center">
<td border=3 vAlign="middle" width="100%" height="100%" bordercolordark=lightgrey bordercolorlight=lightgrey align=center style="cursor:hand;" title="$SectionDesc" onmou搜索引擎优化ver="status=’$SectionDesc’;" onmou搜索引擎优化ut="status=’’;" onclick="window.open(’$URL’,’$target’);"><font color="#000000">$SectionName</font></td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=0 width="100%" height="1">
<tr height="1">
<td bgcolor="Black"></td>
</tr>
</table>
EOD;
}

/**
* 将超毗连中的空格交换为+号
*/
function buildURL($inURL) {
return str_replace(" ","+",$inURL);
}
/**
* 输入javascript剧本
*/
function scriptOut() {
$dh = $this->TopMenuHeight+($this->MenuBarHeight * $this->menuOn);
echo <<<EOD

<script language=javascript>
var AvailHeight // 界说可使用的高度
var LastSection // 界说将要翻开的菜单封闭
var ThisSection // 界说以后需求翻开的菜单
var timerDelay=15 // 界说并设置延时
var menuActive=false // 测定以后举动的菜单
var VisibleHeight // 界说显示高度,肯定是不是显示转动条
var AniRatio // 界说菜单显示滑动的速度

function getSizing() {
// 菜单翻开时失掉的可使用的高度
AvailHeight=document.body.clientHeight-$dh
if(AvailHeight<=0) {
LastSection.style.display=’none’;
}else {
// 改动菜单显示滑动速度的比率
AniRatio=0.75; // 设定速度
if (AvailHeight>200) {AniRatio=0.667;}
if (AvailHeight>500) {AniRatio=0.5;} // 依据可使用高度调剂速度
LastSection.style.height=AvailHeight;
LastSection.style.overflow=’visible’;
LastSection.style.display=’’;
VisibleHeight=parseInt(LastSection.clientHeight);
if (VisibleHeight>AvailHeight) {LastSection.style.overflow=’auto’;}else{LastSection.style.overflow=’hidden’;};
}
}

function slideMenu() {
// 菜单滑动函数
if(parseInt(LastSection.style.height)>1) {
LastSection.style.height=parseInt(parseInt(LastSection.style.height)*AniRatio);
ThisSection.style.height=AvailHeight-parseInt(LastSection.style.height);
var movetimer=setTimeout("slideMenu()",timerDelay) ;
}else {
// 完成菜单滑动,显示新翻开的菜单,埋没后面以翻开的菜单
LastSection.style.display=’none’;
ThisSection.style.height=AvailHeight;
menuActive=false;
if (VisibleHeight>AvailHeight) {ThisSection.style.overflow=’auto’;};
ThisSection.style.marginRight=0;
LastSection=ThisSection;
clearTimeout(movetimer);
}
}

function StartSection(theSection) {
// 入手下手滑动菜单,检测是不是对菜单停止单击
if(menuActive==false) {
if(LastSection!=theSection) {
menuActive=true;
ThisSection=theSection;
LastSection.style.overflow=’hidden’;
ThisSection.style.overflow=’visible’;
ThisSection.style.display=’’;
VisibleHeight=parseInt(ThisSection.clientHeight);
ThisSection.style.overflow=’hidden’;
ThisSection.style.display=’none’;
ThisSection.style.height=1;
LastSection.style.height=AvailHeight-1;
LastSection.style.display=’’;
ThisSection.style.display=’’;
slideMenu()
}
}
}

window.onresize=getSizing
// 启动时翻开默许的序号为第一个的菜单
LastSection=document.all.menuSection1;
LastSection.style.display=’’;
getSizing();
</script>
EOD;
}

function run() {
global $PHP_SELF;
$MenuFontSize = $this->MenuFontSize;
$MenuBackColor = $this->MenuBackColor;
echo <<<EOD
<style>
td { font-size: $MenuFontSize; font-family:"Verdana", "Arial", "宋体"; }
</style>
<body leftmargin=0 topmargin=0 rightmargin=0 bgcolor="$MenuBackColor">
EOD;

/**
* 创立菜单
*/
$this->menuStartSection(2, "代码世界");
$this->menuAddItem("Joy ASP", "接待会见Joy ASP", "$PHP_SELF?key=page&id=Joy ASP");
$this->menuAddItem("Java 世界", "接待会见Java 世界", "$PHP_SELF?key=page&id=Java 世界");
$this->menuAddItem("DotNet 时期", "接待会见DotNet 时期", "$PHP_SELF?key=page&id=DotNet 时期");
$this->menuAddItem("Visual Basic", "接待会见Visual Basic", "$PHP_SELF?key=page&id=Visual Basic");
$this->menuAddItem("Delphi", "接待会见Delphi", "$PHP_SELF?key=page&id=Delphi");
$this->menuEndSection();

$this->menuStartSection(3, "高兴一刻");
$this->menuAddItem("传统笑话", "传统笑话", "$PHP_SELF?key=page&id=传统笑话");
$this->menuAddItem("近代笑话", "近代笑话", "$PHP_SELF?key=page&id=近代笑话");
$this->menuAddSubSection("儿童类");
$this->menuAddItem("校园笑话", "校园笑话", "$PHP_SELF?key=page&id=校园笑话");
$this->menuAddItem("幼儿笑话", "幼儿笑话", "$PHP_SELF?key=page&id=幼儿笑话");
$this->menuAddItem("少年笑话", "少年笑话", "$PHP_SELF?key=page&id=少年笑话");
$this->menuAddSubSectionLine();
$this->menuAddItem("中学时期笑话", "中学时期笑话", "$PHP_SELF?key=page&id=中学时期笑话");
$this->menuAddSubSection("成人笑话");
$this->menuAddItem("带色彩的笑话", "带色彩的笑话", "$PHP_SELF?key=page&id=带色彩的笑话");
$this->menuAddItem("笑话林", "笑话林", "$PHP_SELF?key=page&id=笑话林");
$this->menuEndSection();

$this->menuSectionAsItem(3, "菜单简介", "菜单简介", "$PHP_SELF?key=about");

$this->menuStartSection(1, "团体保藏夹");
$this->menuAddItem("DotNet 时期", "接待会见DotNet 时期", "$PHP_SELF?key=page&id=DotNet 时期");
$this->menuEndSection();

// 将团体保藏夹定为启动菜单
$this->menuOn = 4;
$this->scriptOut();
echo "</body>n";
}
}

class Application {
var $frame;
var $menu;
var $page;
var $about;
function Application() {
$this->frame = new Frame;
$this->about = new About;
$this->page = new Page;
$this->menu = new Menu;
}
function run($key,$id="") {
switch($key) {
case "menu":
$this->menu->run();
break;
case "page":
$this->page->run($id);
break;
case "about":
$this->about->run();
break;
default:
$this->frame->run();
}
}
}
?>
<?php
/** 运转 **/
$app = new Application;
$app->run($key,$id);
?>
  根据功能来进行封装等。很多的不懂,在使用搜索引擎查找,或者请教老师和在老师详细的讲解、指导下,都能顺利解决。
精灵巫婆 该用户已被删除
沙发
发表于 2015-2-16 02:06:59 | 只看该作者
说点我烦的低级错误吧,曾经有次插入mysql的时间 弄了300年结果老报错,其实mysql的时间是有限制的,大概是到203X年  具体的记不清啦,囧。
山那边是海 该用户已被删除
板凳
发表于 2015-3-4 22:38:17 | 只看该作者
刚开始安装php的时候,我图了个省事,把php的扩展全都打开啦(就是把php.ini 那一片 extension 前面的冒号全去掉啦),这样自然有好处,以后不用再需要什么功能再来打开。
因胸联盟 该用户已被删除
地板
发表于 2015-3-8 14:18:51 | 只看该作者
使用zendstdio 写代码的的时候,把tab 的缩进设置成4个空格是很有必要的
谁可相欹 该用户已被删除
5#
发表于 2015-3-8 16:12:06 | 只看该作者
Apache不是非得用80或者8080端口的,我刚开始安得时候就是80端口老占用,就用了个 81端口,结果照常,就是输localhost的时候,应该输入为 localhost:81
只想知道 该用户已被删除
6#
发表于 2015-3-10 04:09:40 | 只看该作者
Ps:以上纯属原创,如有雷同,纯属巧合
飘飘悠悠 该用户已被删除
7#
发表于 2015-3-11 11:07:54 | 只看该作者
刚开始安装php的时候,我图了个省事,把php的扩展全都打开啦(就是把php.ini 那一片 extension 前面的冒号全去掉啦),这样自然有好处,以后不用再需要什么功能再来打开。
再现理想 该用户已被删除
8#
发表于 2015-3-14 15:15:03 | 只看该作者
做为1门年轻的语言,php一直很努力。
admin 该用户已被删除
9#
发表于 2015-3-17 09:08:24 | 只看该作者
其实也不算什么什么心得,在各位大侠算是小巫见大巫了吧,望大家不要见笑,若其中有错误的地方请各位大虾斧正。
柔情似水 该用户已被删除
10#
发表于 2015-3-19 20:09:26 | 只看该作者
作为一个合格的coder 编码的规范是必须,命名方面我推崇“驼峰法”,另外就是自己写的代码最好要带注释,不然时间长了,就算是自己的代码估计看起来都费事,更不用说别人拉。
第二个灵魂 该用户已被删除
11#
发表于 2015-4-1 07:08:25 | 只看该作者
我学习了一段时间后,我发现效果并不好(估计是我自身的问题)。因为一个人的精力总是有限的,同时学习这么多,会导致每个的学习时间都得不到保证。
再见西城 该用户已被删除
12#
发表于 2015-4-2 09:55:03 | 只看该作者
建议加几个专业的phper的群,当然啦需要说话的人多,一处一点问题能有人回答你的,当然啦要让人回答你的问题,平时就得躲在里面聊天,大家混熟啦,愿意回答你问题的人自然就多啦。
若相依 该用户已被删除
13#
发表于 2015-4-3 01:30:42 | 只看该作者
使用zendstdio 写代码的的时候,把tab 的缩进设置成4个空格是很有必要的
小妖女 该用户已被删除
14#
发表于 2015-4-6 01:09:54 | 只看该作者
对于懒惰的朋友,我推荐php的集成环境xampp或者是wamp。这两个软件安装方便,使用简单。但是我还是强烈建议自己动手搭建开发环境。
乐观 该用户已被删除
15#
发表于 2015-4-16 19:09:05 | 只看该作者
我还是强烈建议自己搭建php环境。因为在搭建的过程中你会遇到一些问题,通过搜索或是看php手册解决问题后,你会更加深刻的理解它们的工作原理,了解到php配置文件中的一些选项设置。
若天明 该用户已被删除
16#
发表于 2015-4-21 06:47:15 | 只看该作者
当然这种网站的会员费就几十块钱。
飘灵儿 该用户已被删除
17#
发表于 2015-4-21 16:52:20 | 只看该作者
开发工具也会慢慢的更专业,每个公司的可能不一样,但是zend studio是个大伙都会用的。
透明 该用户已被删除
18#
发表于 2015-4-22 01:35:13 | 只看该作者
说php的话,首先得提一下数组,开始的时候我是最烦数组的,总是被弄的晕头转向,不过后来呢,我觉得数组里php里最强大的存储方法,所以建议新手们要学好数组。
灵魂腐蚀 该用户已被删除
19#
发表于 2015-4-22 07:54:03 | 只看该作者
当留言板完成的时候,下步可以把做1个单人的blog程序,做为目标,
20#
发表于 2015-4-23 03:04:20 | 只看该作者
说php的话,首先得提一下数组,开始的时候我是最烦数组的,总是被弄的晕头转向,不过后来呢,我觉得数组里php里最强大的存储方法,所以建议新手们要学好数组。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-4-29 12:45

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表