用PHP实现换肤

WBOY
发布: 2016-06-23 14:32:23
原创
1316 人浏览过

用PHP其实也可以实现简单的“换肤”,其实就是换CSS(当然不可能做到象asp.net 2.0那样厉害拉),
但有时也可以凑合着使用,先要准备几个CSS
style/default.css
body { font-family: arial, verdana; font-size: small; margin: 0px; }
.box { background: red; }
.box-title { text-align: center; color: white; font-weight: bold; }
.box-content { background: white; font-size: xx-small; padding:10px;}
.menu { margin: 5px; }
.menu-active { margin: 2px; padding:5px; background: black; }
.menu-active a { text-decoration: none; color: white; font-weight: bold; }
.menu-inactive { margin: 2px; padding:5px; background: #ccc; }
.menu-inactive a { text-decoration: none; }

styles/black_and_white.css
body { font-family: arial, verdana; font-size: small; margin: 0px; }
.box { background: #eee; border: 1px solid black; }
.box-title { background: white; text-align: center; font-weight: bold; }
.box-content { background: white; font-size: xx-small; padding:10px;}
.menu { margin: 5px; }
.menu-active { margin: 2px; padding:5px; background: black; }
.menu-active a { text-decoration: none; color: white; font-weight: bold; }
.menu-inactive { margin: 2px; padding:5px; background: #ccc; }
.menu-inactive a { text-decoration: none; }

index.php


$style = "default";
if ( $_GET["style"] )
$style = $_GET["style"];
$files = array( );
$dh = opendir( "styles" );
while( $file = @readdir( $dh ) )
{
if( preg_match( "/[.]css$/", $file ) )
{
$file = preg_replace( "/[.]css$/", "", $file );
$files []= $file;
}
}
?>


















   Important information

Lots of information about important events and
stuff.




Style:




相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!