在线客服
您当前的位置:首页»新闻中心»网站建设»hituxcms首页怎么添加新闻轮播图

hituxcms首页怎么添加新闻轮播图

2014/12/9 16:21:28我要评论(0)
字号:T|T

应客户要求写一个简单的新闻轮播图系统,需要自动调用新闻内有图片的文章。现在写下来与大家共享

目录模版文件夹下index_model.html添加

<div class="topic">
<div class="TopicTitle">图片新闻</div>
<div class="TopicMore"> </div>
</div>
<div class="HeightTab clearfix"></div>
<div class="FocusAD" >
<ul class="slider" >
$web_NewsIMGAD$
</ul>
<ul class="num" >
$web_NewsIMGAD_NO$
</ul>
</div>

css文件夹下添加相应的样式

.FocusAD #buttom_0 {
 background-position:0 0;
}
.FocusAD #buttom_1 {
 background-position:-22px 0;
}
.FocusAD #buttom_2 {
 background-position:-44px 0;
}
.FocusAD #buttom_3 {
 background-position:-66px 0;
}
.FocusAD #buttom_0.selected {
 background-position:0 -16px;
}
.FocusAD #buttom_1.selected {
 background-position:-22px -16px;
}
.FocusAD #buttom_2.selected {
 background-position:-44px -16px;
}
.FocusAD #buttom_3.selected {
 background-position:-66px -16px;
}
/* */
 .FocusAD {
 width:243px;
 height:225px;
 overflow:hidden;
 position:relative;
 padding-left:10px;
 
}
.FocusAD  .slider,.FocusAD  .num{
 position:absolute;
}
.FocusAD  .slider li{
 list-style:none;
 display:inline;
}
.FocusAD  .slider img{
 width:243px;
 height:225px;
 display:block;
}
.FocusAD  .num{
 right:5px;
 bottom:5px;
}
.FocusAD  .num li{
 float: left;
 color: #25b60f;
 text-align: center;
 line-height: 16px;
 width: 16px;
 height: 16px;
 font-family: Arial;
 font-size: 12px;
 cursor: pointer;
 overflow: hidden;
 margin: 3px 1px;
 border: 1px solid #25b60f;
 background-color: #fff;
}
.FocusAD  .num li.on{
 color: #fff;
 line-height: 16px;
 width: 16px;
 height: 16px;
 font-size: 14px;
 margin: 3px 1px;
 border: 1px solid #25b60f;
 background-color: #25b60f;
 font-weight: bold;
}


在inc/x_to_html/文件夹下index_to_html.asp内添加

'小文章幻灯
 
set rsp=server.createobject("adodb.recordset")
 
sql="select top 9 [title],file_path,[image],[time] from [article] where ArticleType=1 and [image]<>'' and view_yes=1 order by [time] desc"
 
rsp.open(sql),cn,1,1
 
if not rsp.eof then
 
for i=1 to rsp.recordcount
 
rs_url=""
 
rs_url=ArticleContent_FolderName&"/"&rsp("file_path")
 
web_NewsIMGAD=web_NewsIMGAD&"<li><a href='"&rs_url&"' target='_blank'><img src='/images/up_images/"&rsp("image")&"' alt='"&rsp("title")&"'/></a></li>"
 
web_NewsIMGAD_NO=web_NewsIMGAD_NO&"<li>"&i&"</li>"
 

rsp.movenext
 
next
 

end if
 
rsp.close
 
set rsp=nothing
replace_code=replace(replace_code,"$web_NewsIMGAD$",web_NewsIMGAD)
 
replace_code=replace(replace_code,"$web_NewsIMGAD_NO$",web_NewsIMGAD_NO)
 

评论(已有0条评论)
请登录后文明发言,并遵守相关规定.
评论内容: