经常在论坛里看到有人问到类似问题,今天就把方法共享一下。
. M$ ]* v# {$ Y7 i
6 e' B" b7 \7 \4 X$ X1)、首先修改 /index.php # x+ e G+ l: @5 t# R5 Z. g; G
找到在它后边添加一些代码$sql="select count(*) as goods_all from ". $ecs->table('goods'); //商品总数
7 `( U( f+ U: ?% g! @ $smarty->assign('goodsnum_all',$db->getOne($sql));3 F2 m. B+ s1 }5 d( W$ R/ j9 h
$time_month=mktime(0,0,0,date('m')-1,1,date('Y'));! i7 u3 x B* k5 X, b; G
$sql="select count(*) as goods_month from ". $ecs->table('goods') ." where last_update >= " . $time_month; //本月更新数7 L% ]+ K8 H8 E5 U4 r/ m# [
$smarty->assign('goodsnum_month',$db->getOne($sql)); |
% N; V) S8 ] ]6 C h. B4 Y( C4 [ {$ J9 g3 i, L8 o
2)、打开首页模板文件 index.dwt,在合适的地方调用,调用代码为本商城共有商品 {$goodsnum_all} 件,本月更新 {$goodsnum_month} 件 |
% Q/ L @2 c! {* j$ F' ] |