在模板文件中插入:
<?php $arrchildid=get_sql_catid("44");?> 44为当前大栏目的id
get_sql_catid函数为phpcms2008自带,$arrchildid包含了and 操作符,sql运行语句,代码如下:
- sql="SELECT a.contentid,a.catid,a.title,a.style,a.url,a.thumb,a.keywords,a.description,a.userid,a.updatetime,a.inputtime,a.islink FROM `ezzcc_content` a, `ezzcc_content_position` p WHERE a.status=99 AND a.contentid=p.contentid AND p.posid=11 $arrchildid ORDER BY a.contentid DESC limit 6" --Vevb.com
截取部分栏目,代码如下:
- sql="SELECT a.contentid,a.catid,a.title,a.style,a.url,a.thumb,a.keywords,a.description,a.userid,a.updatetime,a.inputtime,a.islink FROM `ezzcc_content` a, `ezzcc_content_position` p WHERE a.status=99 AND a.contentid=p.contentid AND p.posid=11 and catid in(44,35,88) ORDER BY a.contentid DESC limit 6"
新闻热点
疑难解答