zoukankan      html  css  js  c++  java
  • ECSHOP显示商品总数和本月更新数

    1)、在网站根目录打开 /index.php 查找

    assign_dynamic('index');

    在下面添加代码:

    $sql="select count(*) as goods_all from ". $ecs->table('goods'); //商品总数
     $smarty->assign('goodsnum_all',$db->getOne($sql));
     $time_month=mktime(0,0,0,date('m')-1,1,date('Y'));
     $sql="select count(*) as goods_month from ". $ecs->table('goods') ." where last_update >= " . $time_month; //本月更新数
     $smarty->assign('goodsnum_month',$db->getOne($sql));

    2)、打开首页模板文件 index.dwt,在合适的地方调用,调用代码

    本商城共有商品 {$goodsnum_all} 件,本月更新 {$goodsnum_month} 件

    如果在全站显视如下修改

    在网站根目录打开文件 includes/init.php 在适当的位置下面添加代码

    我的是放在

    $smarty->assign('ecs_css_path', 'themes/' . $_CFG['template'] . '/style.css');
        }

    这条代码的上边

            $sql="select count(*) as goods_all from ". $ecs->table('goods'); //商品总数
            $smarty->assign('goodsnum_all',$db->getOne($sql));
            $time_month=mktime(0,0,0,date('m')-1,1,date('Y'));
            $sql="select count(*) as goods_month from ". $ecs->table('goods') ." where last_update >= " . $time_month; //本月更新数
            $smarty->assign('goodsnum_month',$db->getOne($sql));

     PS:在要在init.php 文件的最底部添加代码,可能会出现很多不可预测的事情。

    再找到顶部活底部模板文件,放下面的代码放到适当的位置

    本商城共有商品 {$goodsnum_all} 件,本月更新 {$goodsnum_month} 件

    ------------------------------------------华丽丽的分割线--------------------- ------------------------------------

    源厂制造10-10000级洁净无尘车间防静电防尘用品!网址:http://www.lgfjd.com 微信号:614412
  • 相关阅读:
    python3 mock基本使用(转载)
    mock安装(python2)
    Mock简介、场景(转载)
    Fiddler 4的AutoResponder,拦截浏览器重定向返回结果
    .NET 分布式系统架构(有转载部分)
    TCP、IP、HTTP、HTTPS的理解和区别
    根域名,二级域名,子域名的区别
    Restful Api设计浅析
    查询出每门课都大于80分的学生姓名【杭州多测师】【杭州多测师_王sir】
    electron安装+打包
  • 原文地址:https://www.cnblogs.com/wangblognet/p/2728149.html
Copyright © 2011-2022 走看看