博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
DTCMS展示一级栏目并展示各自栏目下的二级栏目
阅读量:6931 次
发布时间:2019-06-27

本文共 2097 字,大约阅读时间需要 6 分钟。

c#代码中

<%csharp%>string parent_id=DTRequest.GetQueryString("parent_id");  if(parent_id!=""&&category_id==0)         {
            category_id=Convert.ToInt32(parent_id);                    } <%/csharp%>

展示一级

分类:
<%if(parent_id=="")%>
">全部 <%else%>
">全部 <%/if%> <%set DataTable categoryList1=get_category_child_list(channel,0)%> <%foreach(DataRow cdr in categoryList1.Rows)%> <%set DataTable childrenList=get_category_child_list(channel,{strtoint({cdr[id]})})%> <%if childrenList.Rows.Count>0 %>
<%if(({strtoint(parent_id)}=={strtoint({cdr[id]})})||(category_id=={strtoint({cdr[id]})}))%>
{cdr[title]}(<%=GetCount(channel,{cdr[id]}," status=0 ") %>) <%else%>
{cdr[title]}(<%=GetCount(channel,{cdr[id]}," status=0 ") %>) <%/if%> <%else%>
<%if(({strtoint(parent_id)}=={strtoint({cdr[id]})})||(category_id=={strtoint({cdr[id]})}))%>
{cdr[title]}(<%=GetCount(channel,{cdr[id]}," status=0 ") %>) <%else%>
{cdr[title]}(<%=GetCount(channel,{cdr[id]}," status=0 ") %>) <%/if%> <%/if %> <%/foreach%>

展示二级栏目

<%if {strtoint(parent_id)}!=0%>      
二级分类:
<%set DataTable childrenList1=get_category_child_list(channel,{strtoint(parent_id)})%> <%foreach(DataRow chd in childrenList1.Rows)%> <%if(category_id=={strtoint({chd[id]})})%>
{chd[title]}(<%=GetCount(channel,{chd[id]}," status=0 ") %>) <%else%>
{chd[title]}(<%=GetCount(channel,{chd[id]}," status=0 ") %>) <%/if%> <%/foreach%>
<%/if %>

 最终效果

 

注意规格或者排序中需要加上parent_id参数

 案例网址

转载于:https://www.cnblogs.com/qigege/p/5048529.html

你可能感兴趣的文章
microsoft.sql.chainer.packagerdata.dll 0x84B10001解决方案
查看>>
让IE支持CSS 3圆角属性的方法(转)
查看>>
MySQL MyISAM与Innodb优化方案比较
查看>>
分享:C语言中Const指针变量(常指针)
查看>>
为ios 应用程序添加图标和添加名字
查看>>
学习C语言一些的好的书和网站
查看>>
[php] 如何将 simplexml_load_string 转换成数组array
查看>>
Ecshop探究之index.php
查看>>
WCF实例上下文以及会话学习
查看>>
Android系统中的广播(Broadcast)机制简要介绍和学习计划
查看>>
Properties 配置文件的读取
查看>>
[后缀数组、不重复子串]SPOJ694、spoj705--Distinct Substrings
查看>>
Mac OS X 10.8.3搭建Android工程源码的编译环境(解决找不到GCC、GIT、PYTHON的问题)...
查看>>
ruby/python/java全覆盖的Selenium-Webdriver系列教程(2)————浏览器的简单操作
查看>>
logcat
查看>>
实验五 含有控制信号的计数器VHDL设计
查看>>
ExtJs 通过分析源代码解决动态加载Controller的问题
查看>>
字符串相似度算法 递归与动态规划求解分析
查看>>
同步博客到CSDN
查看>>
VMware vSphere 服务器虚拟化之二十八 桌面虚拟化之安装View传输服务器
查看>>