destoon当前产品 总数 ,当前求购总数,当前供应总数的标注显示方法
第一步:在include/global.func.php建立table_counts函数
//$table 表明 例如:供应表sell 求购表buy 新闻表:article_21
//$where 条件 例如:status=3 最近一月发布的:status=3 and addtime>=".strtotime('-1 month')."
function table_counts($table,$where){
global $db,$DT_PRE;
$count=$db->get_one("select count(*) as num from $DT_PRE$table where $where");
return $count['num'];
第二步:根据参数调用总数的显示,以下代码是在模板页面添加的。
供应总数:{table_counts('sell','status=3')}
本月供应总数:{table_counts('sell',"status=3 and addtime>=".strtotime('-1 month')."")}
求购总数:{table_counts('buy','status=3')}
本月求购总数:{table_counts('buy',"status=3 and addtime>=".strtotime('-1 month')."")}
新闻总数:{table_counts('article_21','status=3')}
本月求购总数:{table_counts('article_21,"status=3 and addtime>=".strtotime('-1 month')."")}
要调用其他的表数据同理,只需要修改下参数即可。
destoon产品总数,求购总数,供应总数的标注显示
阅读:295
免责声明:
本站部份内容系网友自发上传与转载,不代表本网赞同其观点;
如涉及内容、版权等问题,请在30日内联系,我们将在第一时间删除内容!