aspcms免费开源企业网站开发建设管理系统源码程序

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 5598|回复: 0

AspCms统计产品数量或新闻数量的解决办法

[复制链接]

187

主题

188

帖子

609

积分

高级会员

Rank: 4

积分
609
发表于 2019-10-7 08:30:50 | 显示全部楼层 |阅读模式
aspcms统计产品数量或新闻数量的解决办法



例如:子页面导航为
产品总分类(18)
产品分类一(10)
产品分类二(3)
产品分类三(5)
数字代表该栏目下有多少产品。
以下内容是模拟显示产品数量的解决办法。
此文仅提供解决思路,如果使用以下代码有问题,还需自行修改。
打开inc/AspCms_MainClass.asp
在479行左右找到
for each matchfield in matchesfield
fieldNameAndAttr=regExpReplace(matchfield.SubMatches(0),"[\s]+",chr(32))
fieldNameAndAttr=trimOuter(fieldNameAndAttr)
m=instr(fieldNameAndAttr,chr(32))
if m > 0 then
fieldName=left(fieldNameAndAttr,m - 1)
fieldAttr = right(fieldNameAndAttr,len(fieldNameAndAttr) - m)
else
fieldName=fieldNameAndAttr
fieldAttr = ""
end if

在下面加入

dim selsortid,contotal,contype,newstotal,prototal,downtotal,pictotal,total
selsortid=linkArray(3,i)
set contype=conn.Exec("select sortType from AspCms_Sort where sortID="&selsortid,"r1")
set contotal=conn.Exec("select count (*) from AspCms_Content where sortID="&selsortid,"r1")
if contype(0)=1 or contype(0)=7 then
'alertMsgAndGo contype(0),"-1"
else
set total=conn.Exec("select count (*) from AspCms_Content as c,AspCms_Sort as s where c.sortID="&selsortid&" and c.sortid=s.sortid and s.sortType="&contype(0),"r1")
end if
if contype(0)=2 then
newstotal=total(0)
elseif contype(0)=3 then
prototal=total(0)
elseif contype(0)=4 then
downtotal=total(0)
elseif contype(0)=6 then
pictotal=total(0)
end if
然后在select case fieldName里面加入
case "total"
loopstrLinklistNew=replaceStr(loopstrLinklistNew,matchfield.value,contotal(0))
case "newstotal"
loopstrLinklistNew=replaceStr(loopstrLinklistNew,matchfield.value,newstotal)
case "prototal"
loopstrLinklistNew=replaceStr(loopstrLinklistNew,matchfield.value,prototal)
case "downtotal"
loopstrLinklistNew=replaceStr(loopstrLinklistNew,matchfield.value,downtotal)
case "pictotal"
loopstrLinklistNew=replaceStr(loopstrLinklistNew,matchfield.value,pictotal)
前台aspcms模板调用代码在各页面的栏目循环中加入:新闻:[navlist:newstotal]  产品:[navlist:prostotal]   下载:[navlist:downtotal]   图片:[navlist:pictotal]  不区分分类[navlist:total]
回复

使用道具 举报

*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|aspcms免费开源企业网站开发建设管理系统源码程序 ( 冀ICP备17022052号-2|网站地图

GMT+8, 2024-4-20 15:43 , Processed in 0.038392 second(s), 19 queries .

Powered by aspcms免费开源企业网站开发建设管理系统源码程序

© 2001-2025 aspcms免费开源企业网站开发建设管理系统源码程序

快速回复 返回顶部 返回列表