实现风格转换页面

index.php

<?php
session_start();
include("./conn.php");
include("./init.inc.php");
include("./FCKeditor/fckeditor.php");

//从php文件分配标量的模板变量
$page_title="新闻管理系统";
$tpl->assign("page_title",$page_title);

//从php文件分配数组到模板
$sql="select * from news";
$result=$mysqli->query($sql);
$data=array();
while($row=$result->fetch_assoc()){
$news[]=$row;

}
$tpl->assign("news",$news);
//来自配置文件的变量(作业)
//局部缓存关闭

//$tpl->register_block("nocache","fun1",false);
//根据地址栏的参数判断使用的模板
$action=$_REQUEST['action'];
switch($action){
case "addnewsview";
$tpl->template_dir="";
$tpl->assign("page_title",添加新闻);
$tpl->display("addnews.html",id);
break;

}

if(isset($_POST['select1'])){
$select1 = $_POST['select1'];

echo $select1;
$tpl->assign("select1",$select1);
}


$tpl->display("index.html");

?>



index.html

<html>
<head>
<meta http-equiv="content-type"content="text/html;charset=utf-8">
<title><{$page_title}></title>

<style type="text/css">
body{
margin-top:50px;

}
</style>
<{config_load file="foo.conf" section=$select1}>
<{$select1}>
</head>



<body>
<p>欢迎<{nocache}><{$username}><{/nocache}>登陆新闻管理系统</p>
<hr>
<table width="<{#width#}>" height="<{#height#}>" border="<{#border#}>" bgcolor="<{#bgcolor#}>">
<tr bgcolor="<{#bgcolor#}>">
<td style="font-family:华文彩云;">请选择画面风格</td>
<td>
<form action="index.php" method="post">
<select name="select1" >
<option value="one1">123</option>
<option value="one">可爱风格</option>
<option value="two">温馨风格</option>
<option value="three">动漫风格</option>
<option value="eight">绿色幽幽</option>
</select>
<input type="submit" name="submit" value="修改">
</form>
</td>
<tr>
</tr>
<td>系统管理</td>
<td>
<form name="myform" method="post" action="">
<table border=0>
<tr>
<td width=150>序号</td>
<td width=150>标题</td>
<td width=150>日期</td>
<td width=200>选择</td>

</tr>
<{section loop=$news name=news start=2 step=2 max=3}>
<tr>
<td><{$smarty.section.news.iteration}></td>
<td><{$smarty.section.news.index}></td>
<td><{$news[news].title}></td>
<td><{$news[news].date}></td>
<td><input type="checkbox" name="checkbox[]"></td>



</tr>
<{/section}>

</table>
</td>
</tr>
<tr>

<td><a href="./index.php?action=addnewsview">添加新闻</a></td>

<td><input type="submit" value="删除">
<input type="hidden" name="action" value="<{$actionvalue}>"/>
</form>
</td>

</tr>

</table>



</body>
</html>

你可能感兴趣的:(转换)