织梦channelartlist可嵌套标签中统计并调用栏目的文章数量

时间:2015-11-04 14:08 / 来源:未知 / 作者:admin / 点击:

效果图:

调用标签:{dede:field name='typerow'/}
代码示例:

{dede:channelartlist}
   <div class="heji_box">
           <div class="title">
           <span class="heji_name">
<a href="{dede:field name='typeurl'/}" title="{dede:field name='typename'/}" target="_blank">{dede:field name='typename'/}                </a>共({dede:field name='typerow'/}集)</span></div>
           <div class="heji_con">
            {dede:arclist titlelen='60' row='10'}
          <a href="[field:arcurl /]">[field:title /]</a>
           {/dede:arclist}
              </div>
   </div>
  {/dede:channelartlist}

修改include\taglib\channelartlist.lib.php标签
找到 
$pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);
在其下添加
$pv->Fields['typerow'] = GetTypeRow($typeids[$i]);

修改include\helpers\channelunit.helper.php 结尾增加 

/**
 *获得指定类目的文章数量
 */
if ( ! function_exists('GetTypeRow'))
{function GetTypeRow($typeinfos)
{global $dsql;
$sql = GetSonIds($typeinfos['id']);
$row = $dsql->GetOne("Select count(id) as dd From `dede_archives` where typeid in({$sql})");
$typerow= $row['dd'];
return $typerow;
}
}

猜你喜欢

推荐栏目

DEDECMS
DEDECMS

DEDE使用经验和技巧

WordPress
Wordpress

WP使用经验和技巧

Zblog
Zblog

Zblog使用经验和技巧

CSS
CSS

CSS使用经验和技巧

网络资料
网络资料

转载实用网络资料

按键伤人
按键伤人

转载乱七八糟的网络资源

我是酱油
我是酱油

随笔札记 记录生活点滴

本站推荐

百度站内搜索

专业博客主机