Home > php教程 > php手册 > body text

织梦统计栏目文章总数

WBOY
Release: 2016-06-06 19:37:55
Original
1292 people have browsed it

织梦统计栏目文章总数 无 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}
Copy after login
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template