经常在论坛里看到有人问到类似问题,今天就把方法共享一下。9 H) C/ t d. g- h1 e+ ?2 y' K
6 R: z4 H; j: w, w
1)、首先修改 /index.php % Z$ T+ H, p! Z0 B
找到在它后边添加一些代码$sql="select count(*) as goods_all from ". $ecs->table('goods'); //商品总数
% T3 l B5 A$ W $smarty->assign('goodsnum_all',$db->getOne($sql));; B, t" k& t0 \
$time_month=mktime(0,0,0,date('m')-1,1,date('Y'));
1 c' \0 s3 {0 k& m7 h9 U) f $sql="select count(*) as goods_month from ". $ecs->table('goods') ." where last_update >= " . $time_month; //本月更新数4 l# c& P+ V2 E
$smarty->assign('goodsnum_month',$db->getOne($sql)); |
$ X3 i! N4 o8 q+ @7 M: k; V7 Q x5 K
2)、打开首页模板文件 index.dwt,在合适的地方调用,调用代码为本商城共有商品 {$goodsnum_all} 件,本月更新 {$goodsnum_month} 件 | ! \& x |& n2 g8 l5 x x# j
|