Home  >  Article  >  php教程  >  织梦统计栏目文章总数

织梦统计栏目文章总数

WBOY
WBOYOriginal
2016-06-06 19:37:551293browse

织梦统计栏目文章总数 无 dedecms在列表页统计当前栏目的文章总数量打开include/common.func.php,在 ? 与 ? 中间任一行中添加如下函数。function dynamic_num($current_id){ global $dsql; $t_num = $dsql-GetOne("select count(*) as num from dede_archive

织梦统计栏目文章总数
dedecms在列表页统计当前栏目的文章总数量
打开include/common.func.php,在 <?  与  ?>  中间任一行中添加如下函数。
function dynamic_num($current_id){          
  global $dsql;          
  $t_num = $dsql->GetOne("select count(*) as num from dede_archives where typeid='$current_id'");          
  if(is_array($t_num)){          
 //return "本栏目共有".$t_num[num]."篇文章"; 
 return $t_num[num];        
  }else{          
 //return "本栏目共有0篇文章" ;
 return 0;          
  }          
}  
在列表页、文章页中这样调用:
{dede:type}          
[field:id function="dynamic_num(@me)" /]          
{/dede:type}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn