step.inc.php 安装步骤效果类: 代码如下:
/*** step.inc.php 安装步骤效果类 ** 从comsenz产品的数据表安装效果中提取出主要代码,以供大家学习* @author tianxin* @version 1.0.0 **/class stepclass {function show_header() {define('show_header', true);$step = 1;$version = 'beta1.0';$release = '20100223';$install_lang = '简体中文utf8版';$title = '仿comsenz安装';$charset = 'uft-8';echo <<<eot<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="content-type" c /><title>$title</title><link rel="stylesheet" href="style.css" type="text/css" media="all" /><script type="text/javascript">function $(id) {return document.getelementbyid(id);}function showmessage(message) {$('notice')。value += message + "\\r\\n";}</script><meta c name="copyright" /></head><div><div><h1>$title</h1><span>$version $install_lang $release</span>eot;$step > 0 && $this->show_step($step);}function show_step($step) {$laststep = 4;$title = '仿comsenz安装';$comment = '正在执行操作';$stepclass = array();for($i = 1; $i <= $laststep; $i++) {$stepclass[$i] = $i == $step ? 'current' : ($i < $step ? '' : 'unactivated');}$stepclass[$laststep] .= ' last';echo <<<eot<div><h2>$title</h2><p>$comment</p></div><div><ul><li>1</li><li>2</li><li>3</li><li>4</li></ul><div></div></div></div><div>eot;}function show_install() {?><script type="text/javascript">function showmessage(message) {document.getelementbyid('notice')。value += message + "\r\n";}function initinput() {window.location='http://www.jb51.net';}</script><div><div><textarea name="notice" read></textarea></div><div><input type="button" name="submit" value="正在执行……" disabled >
代码如下:
header('content-type: text/html; charset=utf-8');include('step.inc.php');$step=new stepclass();//显示页面头部$step->show_header();//显示操作进度$step->show_install();//运行操作$step->runquery();echo '<script type="text/javascript">document.getelementbyid("laststep")。disabled=false;document.getelementbyid("laststep")。value = \'执行完所有操作,进入下一步\';</script>'."\r\n";//显示页面尾部$step->show_footer();完整的demo:stepdemo.rar
