主要就是用PHP页面在后台调取数据,然后把数据显示在前台Smarty模板页面上。
主要代码:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
.dis{
display:block;
}
.inline{
display:inline;
}
.none{
display:none;
}
body {
background: #DDEEF2;
padding: 10px;
}
h1 {
background: #F4FAFB;
border: 1px solid #BBDDE5;
color: #9CACAF;
font-size: 14px;
padding: 7px 10px;
margin: 0 0 10px 0;
overflow:hidden;
}
h1 a:visited {
color: #333;
}
h1 a:link {
color: #333;
}
h1 a:hover {
color: #EB8A3D;
}
h1 span{zoom:1;}
.list-div {
width: 100%;
background: #EEF8F9;
border: 1px solid #BBDDE5;
}
.list-div a:visited, .list-div a:link {
text-decoration: underline;
color: #192E32;
}
.list-div a:hover {
color: #9D7250;
}
</style>
<title>新闻中心</title>
</head>
<body>
<div class="list-div">
<{section name=new loop=$array_new}>
<ul>
<{if $array_new[new].news_cate_id eq 1}>
<li><a href="show_news.php?id=<{$array_new[new].id}>"><{$array_new[new].title}></a></li>
<{/if}>
</ul>
<{/section}>
<a href="">更多...</a>
</div>
<div class="list-div">
<{section name=new loop=$array_new}>
<ul>
<{if $array_new[new].news_cate_id eq 2}>
<li><a href="show_news.php?id=<{$array_new[new].id}>"><{$array_new[new].title}></a></li>
<{/if}>
</ul>
<{/section}>
</div>
</body>
</html>