惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园_首页
G
Google Developers Blog
A
About on SuperTechFans
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
博客园 - 聂微东
T
Tailwind CSS Blog
宝玉的分享
宝玉的分享
V
Visual Studio Blog
美团技术团队
The Cloudflare Blog
量子位
T
The Blog of Author Tim Ferriss
罗磊的独立博客
V
V2EX
S
SegmentFault 最新的问题
小众软件
小众软件
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
MyScale Blog
MyScale Blog
博客园 - Franky

北门清燕

🎙️ 科技热文播报 - 2026-03-14 【vscode扩展】apis-tester Notion工具人bot VPS橱窗 - 一个简单的哪吒面板主题 ios17.0可以安装Trollstore了 windows服务器安装mysql踩坑指北 为哪吒面板增加视频背景 继续折腾astro serv00部署FreshRSS 【原创】油猴脚本:哪吒VPS橱窗后台脚本 哪吒面板终极进化之VPS橱窗 哪吒面板default主题小鸡底部增加购买同款按钮 Typecho二开魔改简单指北 【原创】油猴脚本:论坛快捷回帖 简单米表:Typecho-Simple-Mibiao Windows 11 23H2更新遇到下载错误解决方法 Microsoft 365 E5开发者订阅管理员双重认证丢失解决方法 Virtualbox安装Ubuntu不完全指北 一剑开天门 将chrome谷歌浏览器轻松打造成rss阅读器 地震云 罗刹海市 关于笑果我觉得还是罗翔老师说的好 推荐正在玩的游戏:SimpleMMO,附游戏助手SMMOHelper 集成Elog使用notion数据库 【原创】ios捷径:法定工作日打卡提醒 测试AI 再次折腾hexo docker部署freshrss apifox自动导入apidoc接口数据
AspCms在子菜单栏目后面显示产品数量或新闻数量的解决办法
bmqy · 2015-01-11 · via 北门清燕

有时候我们需要在产品栏目后面显示出该栏目下有多少产品,或者新闻栏目下有多少条新闻。例如子页面导航为产品总分类(18)产品分类一(10)产品分类二(3)产品分类三(5)数字代表该栏目下有多少产品。以下内容是模拟显示产品数量的解决办法。

此文仅提供解决思路,如果使用以下代码有问题,还需自行修改。

打开inc/AspCms_MainClass.asp在479行左右找到

| 1 2 3 4 5 6 7 8 9 10 11 | 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) elsefieldName=fieldNameAndAttr fieldAttr = ""end if | | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

在下面加入

| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | dim selsortid,contotal,contype,newstotal,prototal,downtotal,pictotal,total selsortid=linkArray(3,i) set contype=conn.Exec("select sortType from {prefix}Sort where sortID="&selsortid,"r1") set contotal=conn.Exec("select count (*) from {prefix}Content where sortID="&selsortid,"r1") if contype(0)=1 or contype(0)=7 then alertMsgAndGo contype(0),"-1"elseset total=conn.Exec("select count (*) from {prefix}Content as c,{prefix}Sort as s where c.sortID="&selsortid&" and c.sortid=s.sortid and s.sortType="&contype(0),"r1") end ifif 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里面加入

| 1 2 3 4 5 6 7 8 9 10 | 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) | | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

前台调用代码在各页面的栏目循环中加入:新闻:[navlist

] 产品:[navlist] 下载:[navlist] 图片:[navlist] 不区分分类[navlist]

通过 AspCms在子菜单栏目后面显示产品数量或新闻数量的解决办法 _乐知心觉_新浪博客.

欢迎关注我的其它发布渠道

公众号小程序

文章标题:AspCms在子菜单栏目后面显示产品数量或新闻数量的解决办法

文章作者:bmqy

文章链接:https://bmqy.net/1518.html[复制]

最后修改时间:


商业转载请联系站长获得授权,非商业转载请注明本文出处及文章链接,您可以自由地在任何媒体以任何形式复制和分发作品,也可以修改和创作,但是分发衍生作品时必须采用相同的许可协议。
本文采用CC BY-NC-SA 4.0进行许可。