📄 con_news.asp
字号:
<!-- #include file="skin.asp" -->
<%
dim CMS_Skin_Mod
set CMS_Skin_Mod=New Class_CMS_Skin_Mod
CMS_Skin_Mod.Class_DB("新闻_1") '注:("新闻_1")要和模板同名
%>
<!-- #include file="jk_nsort.asp" -->
<!-- #include file="../style/data_sort_news.asp" -->
<%
dim tmp_img_h
cid=0
sid=0
n_sort="news"
index_url="news"
tit_fir=format_menu(index_url)
m_channel=index_url
web_img_m="m_"&m_channel
web_img_h="h_"&m_channel
tmp_img_h=web_img_h
sub news_end()
if isarray(sort_dim) then erase sort_dim
CMS_Skin_Mod.sk_end
set CMS_Skin_Mod=nothing
end sub
sub news_left(nt,n_num,c_num,n_title)
dim n_username,n_topic,n_tim,tmp
sql="select top "&n_num&" id,username,topic,tim,counter,ispic,istop,tcolor,pic from news where hidden=1"
select case nt
case "hot"
sql=sql&" order by counter desc,id desc"
case "good"
sql=sql&" and istop=1 order by id desc"
case "pic"
sql=sql&" and ispic=1 order by id desc"
case else
sql=sql&" order by id desc"
end select
set rs=joekoe_cms.exec(sql,1)
do while not rs.eof
n_username=rs("username")
n_topic=rs("topic")
n_tim=rs("tim")
n_tim=joekoe_cms.time_type(n_tim,1)
tmp=tmp&news_topic_type(c_num,rs("id"),n_username,n_topic,n_tim,rs("counter"),rs("ispic"),0,rs("tcolor"))
rs.movenext
loop
rs.close
call news_bar_top(n_title,tmp,1,2,"")
end sub
Sub news_bar_top(tit,body,tt,ttype,tmore)
dim w_wid,more_var,tmp
w_wid="20%"
if len(tit)>10 then w_wid="45%"
if len(tit)>25 then w_wid="70%"
if int(ttype)=2 then w_wid="45%"
more_var="<img src='"&joekoe_cms.web_dir_skin&"main/"&m_channel&"_more_0"&ttype&".gif' border=0>"
if tmore<>"" or var_null(tmore)<>"" then
more_var="<a href='"&tmore&"'><img src='"&joekoe_cms.web_dir_skin&"main/"&m_channel&"_more_1"&ttype&".gif' border=0 alt='点击浏览更多……'></a>"
end if
web_img_h=tmp_img_h&ttype
if tt=1 then body="<table border=0 width='100%'>"&body&"</table>"
tmp=CMS_Skin_Mod.GetDB("left")
tmp=Replace(tmp,"{$web_skin}",joekoe_cms.web_dir_skin)
tmp=Replace(tmp,"{$channel}",m_channel)
tmp=Replace(tmp,"{$ttype}",ttype)
tmp=Replace(tmp,"{$wid}",w_wid)
tmp=Replace(tmp,"{$img}",img_skin(web_img_m&ttype))
tmp=Replace(tmp,"{$tit}",tit)
tmp=Replace(tmp,"{$more}",more_var)
tmp=Replace(tmp,"{$body}",body)
tmp=Replace(tmp,"{$ukong}",CMS_Skin.skukong)
Response.Write (Vbcrlf&tmp)
end Sub
function news_topic_type(b_c_num,b_id,b_username,b_topic,b_tim,b_counter,b_ispic,b_tim_type,tcolor)
dim n_url,n_jt
n_url="news_view.asp?id="&b_id
n_jt=img_skin(web_img_h)
news_topic_type=format_news_topic_type(n_jt,b_username,b_topic,b_c_num,n_url,b_tim,b_counter,b_ispic,"新闻标题","浏览人次",b_tim_type,tcolor)
end function
function format_news_topic_type(b_jt,b_username,b_topic,b_c_num,b_url,b_tim,b_counter,b_ispic,b_tit,b_count,b_tim_type,tcolor)
dim n_img,tim_type,n_c_num
n_c_num=b_c_num
if b_ispic then
n_img=" <img src='"&joekoe_cms.web_dir_skin&"small/img.gif' border=0>"
n_c_num=n_c_num-2
end if
if b_tim_type>0 then
if b_tim_type=2 then tim_type=tim_type&"</td><td align=right>"
tim_type=tim_type&" <font class=tims>"&mid(b_tim,6,5)&"</font>"
end if
if var_null(tcolor)<>"" then tcolor="style=""color:"&tcolor&";"""
format_news_topic_type="<tr><td height="&m_hei&"> "&b_jt&"<a href='"&b_url&"' target=_blank alt='"&b_tit&":"&joekoe_cms.code_html(b_topic,1,0)&"<br>发 布 人:"&b_username&"<br>"&b_count&":"&b_counter&" 人次<br>整理时间:"&b_tim&"' "&tcolor&">"&joekoe_cms.code_html(b_topic,1,n_c_num)&"</a>"&n_img&tim_type&"</td></tr>"
end function
function news_label_list()
dim temp1
temp1=temp1&"<table border=0 cellspacing=0 cellpadding=4>" & _
vbcrlf&"<tr><td> "&img_skin("label_"&m_channel)&" <a href='news_list.asp?action=pic'"
if action="pic" then temp1=temp1&" class=red"
temp1=temp1&">图片新闻</a></td></tr>" & _
vbcrlf&"<tr><td> "&img_skin("label_"&m_channel)&" <a href='news_list.asp?action=good'"
if action="good" then temp1=temp1&" class=red"
temp1=temp1&">推荐新闻</a></td></tr>" & _
vbcrlf&"<tr><td> "&img_skin("label_"&m_channel)&" <a href='news_list.asp?action=hot'"
if action="hot" then temp1=temp1&" class=red"
temp1=temp1&">热门新闻</a></td></tr>" & _
vbcrlf&"</table>"
news_label_list=temp1
end function
function news_list_pagecute(p_nummer,p_rssum,p_viewpage,p_thepages,p_pageurl)
dim temp1
temp1=temp1&vbcrlf&"<table border=0 width='98%' cellspacing=0 cellpadding=2>" & _
vbcrlf&"<tr>" & _
vbcrlf&"<td height=25>" & _
vbcrlf&" 本栏共有 <font class=red>"&p_rssum&"</font> 条新闻" & _
vbcrlf&"页次:<font class=red>"&p_viewpage&"</font>/<font class=red>"&p_thepages&"</font> " & _
vbcrlf&" 分页:"&jk_pagecute(p_nummer,p_thepages,p_viewpage,p_pageurl,5,"#ff0000") & _
vbcrlf&"</td>" & _
vbcrlf&"</tr></table>"&ukong
news_list_pagecute=temp1
end function
function news_search_list(stit)
dim keyvar,temp1
keyvar="请输入关键字"
temp1=temp1&vbcrlf&"<table border=0>" & _
vbcrlf&"<form name=news_sea_frm action='news_list.asp' method=get onsubmit=""javascript:frm_submitonce(this);"">" & _
vbcrlf&"<input type=hidden name=action value='search'>" & _
vbcrlf&"<tr height=30>" & _
vbcrlf&"<td>"&img_skin("new")&"</td>" & _
vbcrlf&"<td wdith=5></td>" & _
vbcrlf&"<td>"&select_type(stit,0,0)&"</td>" & _
vbcrlf&"<td wdith=5></td>" & _
vbcrlf&"<td><select name=sea_type sizs=1><option value='topic'>"&stit&"标题</option><option value='username'>发布人</option></seelct></td>" & _
vbcrlf&"<td wdith=5></td>" & _
vbcrlf&"<td><select name=sea_term sizs=1><option value='all'>满足所有条件</option><option value='only'>满足一个条件</option></seelct></td>" & _
vbcrlf&"<td wdith=5></td>" & _
vbcrlf&"<td><input type=text name=keyword size=20 maxlength=20 title='多个关键字请用 空格 格开' class=bg_search></td>" & _
vbcrlf&"<td wdith=5></td>" & _
vbcrlf&" <td><input type=submit value='搜索' onclick=""javascript:return news_sea('"&stit&"');""></td>" & _
vbcrlf&"</tr></form></table>" & _
vbcrlf&"<script language=javascript>" & _
vbcrlf&"function news_sea(stit)" & _
vbcrlf&"{" & _
vbcrlf&" if (document.news_sea_frm.keyword.value==""请输入关键字"")" & _
vbcrlf&" {" & _
vbcrlf&" alert('请在搜索"&stit&"前先输入要查询的 关键字 !');" & _
vbcrlf&" document.news_sea_frm.keyword.focus();" & _
vbcrlf&" return false;" & _
vbcrlf&" }" & _
vbcrlf&"}" & _
vbcrlf&"</script>"
news_search_list=temp1
end function
sub news_more(m_nummer,m_num,m_title)
dim sqladd,sqladd_head,sqladd_end,nums,n_username,n_topic,n_tim,mhead,cname,sname,sea_type,keyword,sea_term,tmp
rssum=0
nums=nummer
sqladd_head=""
sqladd_end=""
select case action
case "search"
mhead=m_title&" → "&tit
if cint(sid)>0 then sqladd=" and c_id="&cid
if cint(sid)>0 then sqladd=sqladd&" and s_id="&sid
sea_type=trim(request.querystring("sea_type"))
keyword=joekoe_cms.code_form(request.querystring("keyword"))
sea_term=trim(request.querystring("sea_term"))
if sea_type<>"username" then sea_type="topic"
if sea_term<>"only" then sea_term="all"
sqladd_end=sql_key(keyword,sea_type,2,sea_term)
if sqladd_end<>"" then
sqladd=sqladd&" and "&sqladd_end
sqladd_end=""
mhead=mhead&"(关键字:"&keyword&")"
end if
pageurl=pageurl&"keyword="&server.urlencode(keyword)&"&sea_type="&sea_type&"&"
case "hot"
mhead=m_title&" → "&tit&"(最新"&m_nummer&"条)"
sqladd=""
sqladd_head=" top "&m_nummer
sqladd_end=" counter desc,"
case "pic"
mhead=m_title&" → "&tit
sqladd=" and ispic=1"
case "good"
mhead=m_title&" → "&tit
sqladd=" and istop=1"
case else
sql="select c_name from jk_class where c_id="&cid
sqladd=" and c_id="&cid
if cint(sid)>0 then
sqladd=" and s_id="&sid
sql="select jk_class.c_name,jk_sort.s_name from jk_sort inner join jk_class on jk_sort.c_id=jk_class.c_id where jk_sort.c_id="&cid&" and jk_sort.s_id="&sid
end if
set rs=joekoe_cms.exec(sql,1)
if rs.eof then
rs.close
call news_list(6,30)
exit sub
end if
cname=rs("c_name")
if cint(sid)>0 then sname=rs("s_name")
rs.close
mhead=m_title&" → "&cname
if sid>0 and sname<>"" then mhead=mhead&" → "&sname
end select
sql="select"&sqladd_head&" id,topic,tim,username,counter,ispic,tcolor from news where hidden=1"&sqladd&" order by "&sqladd_end&"id desc"
call joekoe_cms.exec("",-1)
rs.open sql,conn,1,1
if not rs.eof then rssum=rs.recordcount
call format_pagecute()
if cint(viewpage)>1 then rs.move (viewpage-1)*nummer
if int(viewpage*nummer)>int(rssum) then nums=nummer-(viewpage*nummer-rssum)
for i=1 to nums
n_username=rs("username")
n_topic=rs("topic")
n_tim=rs("tim")
n_tim=joekoe_cms.time_type(n_tim,1)
tmp=tmp&news_topic_type(m_num,rs("id"),n_username,n_topic,n_tim,rs("counter"),rs("ispic"),2,rs("tcolor"))
rs.movenext
next
rs.close
call news_bar_top(mhead,tmp,1,1,"")
if action<>"hot" then response.write news_list_pagecute(nummer,rssum,viewpage,thepages,pageurl)
end sub
sub news_list(n_num,c_num)
dim nsid,nsname,srs,ssql,sqla,n_username,n_topic,n_tim,sid_num,tmp
sid_num=0
ssql="select s_id,s_name from jk_sort where c_id="&cid&" order by s_order"
set srs=joekoe_cms.exec(ssql,1)
do while not srs.eof
sid_num=1
nsid=srs("s_id")
nsname=srs("s_name")
sqla=" and s_id="&nsid
sql="select top "&n_num&" id,topic,tim,username,counter,ispic,tcolor from news where hidden=1 and s_id="&nsid&" order by id desc"
set rs=joekoe_cms.exec(sql,1)
do while not rs.eof
sid_num=2
n_username=rs("username")
n_topic=rs("topic")
n_tim=rs("tim")
n_tim=joekoe_cms.time_type(n_tim,1)
tmp=tmp&news_topic_type(c_num,rs("id"),n_username,n_topic,n_tim,rs("counter"),rs("ispic"),2,rs("tcolor"))
rs.movenext
loop
rs.close
call news_bar_top(nsname,tmp,1,1,"?action=more&c_id="&cid&"&s_id="&nsid)
tmp=""
srs.movenext
loop
srs.close
set srs=nothing
end sub
sub news_fpic(nt,t_num,n_num,c_num,n_title)
dim tmp,temp,pid,nid,n_topic,n_username,n_tim
sql="select top 1 id,topic,pic,tcolor from news where hidden=1 and ispic=1 order by id desc"
set rs=joekoe_cms.exec(sql,1)
if not rs.eof then
n_topic=rs("topic")
temp=format_pic_type(rs("pic"),n_topic,t_num,"news_view.asp?id="&rs("id"))
end if
rs.close
tmp=tmp&"<tr>" & _
vbcrlf&"<td align=center width='30%'>"&temp&"</td>" & _
vbcrlf&"<td width='70%'>" & _
vbcrlf&"<table border=0>"
sql="select top "&n_num&" id,username,topic,tim,counter,ispic,tcolor from news where hidden=1 and ispic=1"
select case nt
case "hot"
sql=sql&" order by counter desc,id desc"
case "good"
sql=sql&" and istop=1 order by id desc"
case else
sql=sql&" order by id desc"
end select
set rs=joekoe_cms.exec(sql,1)
do while not rs.eof
n_username=rs("username")
n_topic=rs("topic")
n_tim=rs("tim")
n_tim=joekoe_cms.time_type(n_tim,1)
tmp=tmp&news_topic_type(c_num,rs("id"),n_username,n_topic,n_tim,rs("counter"),rs("ispic"),1,rs("tcolor"))
rs.movenext
loop
rs.close
tmp=tmp&"</table></td></tr>"
call news_bar_top(n_title,tmp,1,1,"")
end sub
sub news_pic(nt,n_num,c_num,n_title)
dim tmp,nid,per_num,n_topic
per_num=100\n_num
tmp=tmp&"<tr align=center>"
sql="select top "&n_num&" id,topic,pic from news where hidden=1 and ispic=1"
select case nt
case "hot"
sql=sql&" order by counter desc,id desc"
case "good"
sql=sql&" and istop=1 order by id desc"
case else
sql=sql&" order by id desc"
end select
set rs=joekoe_cms.exec(sql,1)
do while not rs.eof
n_topic=rs("topic")
tmp=tmp&"<td width='"&per_num&"%'>"&format_pic_type(rs("pic"),n_topic,c_num,"news_view.asp?id="&rs("id"))&"</td>"
rs.movenext
loop
rs.close
tmp=tmp&"</tr>"
call news_bar_top(n_title,tmp,1,1,"news_list.asp?action=pic")
end sub
sub news_main_list(n_num,c_num)
dim ncid,ncname,crs,csql,sqla,n_username,n_topic,n_tim,tmp
csql="select c_id,c_name from jk_class where nsort='"&n_sort&"' order by c_order"
set crs=joekoe_cms.exec(csql,1)
do while not crs.eof
ncid=crs("c_id")
ncname=crs("c_name")
sqla=" and c_id="&ncid
sql="select top "&n_num&" id,topic,tim,username,counter,ispic,tcolor from news where hidden=1 and c_id="&ncid&" order by id desc"
set rs=conn.execute(sql)
do while not rs.eof
n_username=rs("username")
n_topic=rs("topic")
n_tim=rs("tim")
n_tim=joekoe_cms.time_type(n_tim,1)
tmp=tmp&news_topic_type(c_num,rs("id"),n_username,n_topic,n_tim,rs("counter"),rs("ispic"),2,rs("tcolor"))
rs.movenext
loop
rs.close
call news_bar_top(ncname,tmp,1,1,"news_list.asp?action=more&c_id="&ncid)
tmp=""
crs.movenext
loop
crs.close
set crs=nothing
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -