首页调用栏目的一级、二级分类数据的方法-作者:2013


1、打开index2.asp文件,找到:

sub main_center_list(cl_type,cl_tnum,cl_cnum,cl_classid)
dim tmp1,tmp_title,tmp_tit,tmp_count,tmp_img,tmp_record,tmp_table,tmp_where,tmp_url
tmp_img=cl_type
tmp_where="hidden=1"
if cl_classid>0 then tmp_where=tmp_where&" and s_id="&cl_classid
select case cl_type
case "forum"
cl_type="forum"
tmp_title="论坛新帖"
tmp_tit="论坛标题"
tmp_count="论坛回复"
tmp_img="forum"
tmp_table="bbs_topic"
tmp_record="id,topic,username,tim,re_counter,forum_id"
tmp_where="forum_id>0"
if cl_classid>0 then tmp_where="forum_id="&cl_classid
case "down"
tmp_title="软件下载"
tmp_tit="软件名称"
tmp_count="下载次数"
tmp_table="down"
tmp_record="id,name,username,tim,counter"
case "news"
tmp_title="行业动态"
tmp_tit="新闻标题"
tmp_count="浏览次数"
tmp_table="news"
tmp_record="id,topic,username,tim,counter"
tmp_img="article"
case else
tmp_title="技术文栏"
tmp_tit="文章标题"
tmp_count="浏览次数"
tmp_table="article"
tmp_record="id,topic,username,tim,counter"
end select
sql="select top "&cl_tnum&" "&tmp_record&" from "&tmp_table&" where "&tmp_where&" order by id desc"
set rs=joekoe_cms.exec(sql,1)
do while not rs.eof
tmp_url=cl_type&"_view.asp?id="&rs(0)
if cl_type="forum" then
tmp_url=cl_type&"_view.asp?forum_id="&rs(5)&"&view_id="&rs(0)
end if
'tmp1=tmp1&format_topic_type(img_skin("h_"&tmp_img),rs(2),rs(1),cl_cnum,tmp_url,rs(3),rs(4),false,tmp_tit,tmp_count,0)
tmp1=tmp1&vbcrlf&"<tr><td height="&dim_num(6)&">"&img_skin("h_"&tmp_img)&"<a href='"&tmp_url&"' alt='"&tmp_tit&":"&joekoe_cms.code_html(rs(1),1,0)&"<br>发 布 人:"&rs(2)&"<br>"&tmp_count&":"&rs(4)&" 人次<br>整理时间:"&rs(3)&"' target=_blank>"&joekoe_cms.code_html(rs(1),1,cl_cnum)&"</a></td></tr>"
rs.movenext
loop
rs.close
tmp1="<table border=0 cellspacing=0 cellpadding=2 width='100%'>"&tmp1&vbcrlf&"</table>"
response.write vbcrlf&"<table cellspacing=1 cellpadding=4 class=table>" & _
vbcrlf&"<tr><td class=td0> "&tmp_title&"</td></tr>" & _
vbcrlf&"<tr class=bg_td><td align=center>"&tmp1&"</td></tr>" & _
vbcrlf&"</table>"&ukong
end sub

替换成:

sub main_center_list(cl_type,cl_tnum,cl_cnum,cl_classid)
dim tmp1,tmp_title,tmp_tit,tmp_count,tmp_img,tmp_record,tmp_table,tmp_where,tmp_url
'tmp_img=cl_type
tmp_where="hidden=1"
if cl_classid>0 then tmp_where=tmp_where&" and s_id="&cl_classid
select case cl_type
case "forum"
cl_type="forum"
tmp_title="论坛新帖"
tmp_tit="论坛标题"
tmp_count="论坛回复"
tmp_img="forum"
tmp_table="bbs_topic"
tmp_record="id,topic,username,tim,re_counter,forum_id"
tmp_where="forum_id>0"
if cl_classid>0 then tmp_where="forum_id="&cl_classid

case "down"
tmp_title="软件下载"
tmp_tit="软件名称"
tmp_count="下载次数"
tmp_img="down"
tmp_table="down"
tmp_record="id,name,username,tim,counter,c_id"
tmp_where="c_id>0"
if cl_classid>0 then tmp_where="c_id="&cl_classid

case "news"
tmp_title="行业动态"
tmp_tit="新闻标题"
tmp_count="浏览次数"
tmp_img="article"
tmp_table="news"
tmp_record="id,topic,username,tim,counter,c_id"
tmp_where="c_id>0"
if cl_classid>0 then tmp_where="c_id="&cl_classid

case else
tmp_title="技术文栏"
tmp_tit="文章标题"
tmp_count="浏览次数"
tmp_img="article"
tmp_table="article"
tmp_record="id,topic,username,tim,counter,s_id"
tmp_where="s_id>0"
if cl_classid>0 then tmp_where="s_id="&cl_classid
end select
sql="select top "&cl_tnum&" "&tmp_record&" from "&tmp_table&" where "&tmp_where&" order by id desc"
set rs=joekoe_cms.exec(sql,1)
do while not rs.eof
tmp_url=tmp_table&"_view.asp?id="&rs(0)
if cl_type="forum" then
tmp_url=cl_type&"_view.asp?forum_id="&rs(5)&"&view_id="&rs(0)
end if
'tmp1=tmp1&format_topic_type(img_skin("h_"&tmp_img),rs(2),rs(1),cl_cnum,tmp_url,rs(3),rs(4),false,tmp_tit,tmp_count,0)
tmp1=tmp1&vbcrlf&"<tr><td height="&dim_num(6)&">"&img_skin("h_"&tmp_img)&"<a href='"&tmp_url&"' alt='"&tmp_tit&":"&joekoe_cms.code_html(rs(1),1,0)&"<br>发 布 人:"&rs(2)&"<br>"&tmp_count&":"&rs(4)&" 人次<br>整理时间:"&rs(3)&"' target=_blank>"&joekoe_cms.code_html(rs(1),1,cl_cnum)&"</a></td></tr>"
rs.movenext
loop
rs.close
tmp1="<table border=0 cellspacing=0 cellpadding=2 width='100%'>"&tmp1&vbcrlf&"</table>"
response.write vbcrlf&"<table cellspacing=1 cellpadding=4 class=table>" & _
vbcrlf&"<tr><td class=td0> "&tmp_title&"</td></tr>" & _
vbcrlf&"<tr class=bg_td><td align=center>"&tmp1&"</td></tr>" & _
vbcrlf&"</table>"&ukong
end sub

下面以下载为例,说明。

index2.asp 中,找到
sub main_center_list(cl_type,cl_tnum,cl_cnum,cl_classid)
dim tmp1,tmp_title,tmp_tit,tmp_count,tmp_img,tmp_record,tmp_table,tmp_where,tmp_url
tmp_where="hidden=1"
if cl_classid>0 then tmp_where=tmp_where&" and s_id="&cl_classid
select case cl_type

增加:

case "down1"
tmp_title="工具软件"
tmp_tit="软件名称"
tmp_count="下载次数"
tmp_img="down"
tmp_table="down"
tmp_record="id,name,username,tim,counter,c_id"
tmp_where="c_id>0"
if cl_classid>0 then tmp_where="c_id="&cl_classid

然后,在你需要的地方,插入下面的调用:
<%call main_center_list("down1",8,20,1)%>
蓝色就是调用的定义函数,红色的就是下载分类c_id数值!

调用二级分类时,将c_id 改成 s_id ,就可以了。

其他栏目、一、二级分类同理。


下面对这个调用模块进行一些说明,以便大家明白了当。

case "down1"
调用的函数定义,也就是这个调用语句中的蓝色字,只要注意与其他的定义名称不同就可以。<%call main_center_list("down1",8,20,1)%>

tmp_title="工具软件"
定义首页栏目调用名称,比如:“论坛新贴”、“行业动态”、“技术文栏”等,调用一、二级分类时,就写成需要调用的当前分类名称,比如:“工具软件”、“系统软件”、“ASP源码”等等。

tmp_tit="软件名称"
鼠标指向标题时的提示中的内容

tmp_count="下载次数"
鼠标指向标题时的提示中的内容

tmp_img="down"
定义标题前的小图标,默认是调用skin/skin_*/small/h_down.gif,其他类推;

tmp_table="down"
定义当前调用的数据库表名;

tmp_record="id,name,username,tim,counter,c_id"
定义上句数据库表中的这些项,其中最后一项为我修改添加,目的是便于调用一、二级分类,c_id 为一级分类, s_id 为二级分类

tmp_where="c_id>0"
定义分类的调用范围。可以灵活定义,调用不同的多个分类,比如:c_id=2 or c_id=6 ,就可以调用这二个分类了

if cl_classid>0 then tmp_where="c_id="&cl_classid
定义<%call main_center_list("down1",8,20,1)%>中红色数据的调用范围,与上面的 tmp_where="c_id>0" 共同定义调用的范围,相互配合,可以调用任何的单独、多个分类、栏目的数据。

有许多的网友在看到我这篇修改文章后,急忙地去修改,却没有注意到我的替换代码与原始的cms1.2的代码中红色部分的不同之处,就是这些不同,导致后面的修改无法正确的显示、或正确链接(如果没有替换我的修改代码,就无法正确链接到数据库)

所以,请大家一定要用我的修改代码替换原始的代码,记住!!

帖子出处:http://www.joekoe.com/forum/view_45285.html

9-1.2滚动友情链接修改方法(图片从右至左滚动)-作者:carllym

1。首页sub main_center_link() 中添加红色部分
vbcrlf&"<tr class=bg_td><td align=center><marquee scrollamount=2 direction=left width='100%' onMouseOver=this.stop() onMouseOut=this.start()>"&tmp1&"</marquee></td></tr>" & _

2。如果想后台生成的data_link_fir.js中每行为10个链接
可以修改admin_links.asp中
filetype=links_fso("fir",5)为10

演示:http://www.shuichan.net/joekoe

更正
第二步中请更改
file_name="style/data_link.js"
filetype=links_fso("fir",5)
call create_file(file_name,filetype)
中的5为10
另外 首页sub main_center_link() 中
<script language=javascript src='style/data_link_fir.js'></script>
改为
<script language=javascript src='style/data_link.js'></script>

帖子出处:http://www.joekoe.com/forum_view.asp?forum_id=7&view_id=45130

10-如何将CMS1.2的首页 “推荐产品”改为二行、八种产品?-作者:yucity

打开index2.asp 小改一下就可以,如下:

原来的:
'---------------------------中间1 开始----------------------------
call main_center_shop(4,12)
'---------------------------中间1 结束----------------------------
其中4是指取4条数据库记录,要改为8,12是指最多显示名称12个字符,既然改就改的比较方便些,那么就添一个参数“row_num”,表示8条记录分几行显示,这里需要2行,所以上面的改成这样:
'---------------------------中间1 开始----------------------------
call main_center_shop(8,12,2)
'---------------------------中间1 结束----------------------------

函数调用就这样改好了,接着要改函数了,如下:

也在index2.asp中,找到sub main_center_shop(cs_tnum,cs_cnum)过程。

将它改成这样就可以:

sub main_center_shop(cs_tnum,cs_cnum,row_num)
dim tmp1,tmp_topic,tmp_url,i,col_num
col_num=round(cs_tnum/row_num)
tmp1=vbcrlf&"<tr align=center>"
sql="select top "&cs_tnum&" id,name,smallimg from shop_product where hidden=1 order by id desc"
set rs=joekoe_cms.exec(sql,1)
i=1
do while not rs.eof
tmp_topic=rs(1)
tmp_url="shop_view.asp?id="&rs(0)
tmp1=tmp1&vbcrlf&"<td align=center>" & _
vbcrlf&" <table border=0 cellspacing=0 cellpadding=0>" & _
vbcrlf&" <tr><td align=center>"&pic_fk(rs("smallimg"),1,tmp_url)&"</td></tr>" & _
vbcrlf&" <tr><td align=center height="&dim_num(6)&"><a href='"&tmp_url&"' target=_blank>"&joekoe_cms.code_html(tmp_topic,1,cs_cnum)&"</a></td></tr>" & _
vbcrlf&" </table>" & _
vbcrlf&"</td>"
rs.movenext
if i mod col_num =0 then tmp1=tmp1&"</tr><tr>"
i=i+1
loop
rs.close
tmp1=tmp1&vbcrlf&"</tr>"
tmp1="<table border=0 cellspacing=0 cellpadding=2 width='100%'>"&tmp1&vbcrlf&"</table>"
response.write vbcrlf&"<table cellspacing=1 cellpadding=4 class=table>" & _
vbcrlf&"<tr><td class=td0> 推荐产品</td></tr>" & _
vbcrlf&"<tr class=bg_td><td align=center>"&tmp1&"</td></tr>" & _
vbcrlf&"</table>"&ukong
end sub

经过这样一改就一劳永逸了,如果要显示12个3行,就调用call main_center_shop(12,12,3),4行就把那个3改成4,其他自己看情况随意控制吧。

http://www.joekoe.com/forum_view.asp?forum_id=7&view_id=49475


case "news1"
tmp_title="风云动态"
tmp_tit="新闻名称"
tmp_count="浏览次数"
tmp_img="article"
tmp_table="news"
tmp_record="id,topic,username,tim,counter,s_id"
tmp_where="hidden=1"
if cl_classid>0 then tmp_where=tmp_where&" and s_id="&cl_classid

上面是个例子,注意加上颜色的代码,就是去除未审核的文章。
http://www.joekoe.com/forum_view.asp?forum_id=7&view_id=45497&page=1

[本日志由 cmscn 于 2006-12-03 01:43 AM 编辑]
文章来自: Original
引用通告: 查看所有引用 | 我要引用此文章
Tags:
相关日志:
评论: 8 | 引用: 0 | 查看次数: 973
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 20 字 | UBB代码 关闭 | [img]标签 关闭