设置ecshop最新文章列表在所有页面显示
2016-09-07 22:03 来源:www.chinab4c.com 作者:ecshop专家
设置ecshop最新文章列表在所有页面显示
把 $smarty->assign('new_articles', index_get_new_articles()); // 最新文章 (责任编辑:chinab4c)加到init.php 中的 $smarty->assign('lang', $_LANG);下面 再把function index_get_new_articles() { $sql = 'SELECT a.article_id, a.title, ac.cat_name, a.add_time, a.file_url, a.open_type, ac.cat_id ' . ' FROM ' . $GLOBALS['ecs']->table('article') . ' AS a, ' . $GLOBALS['ecs']->table('article_cat') . ' AS ac' . ' WHERE a.is_open = 1 AND a.cat_id = ac.cat_id AND ac.cat_type = 1' . ' ORDER BY a.article_type DESC, a.add_time DESC LIMIT ' . $GLOBALS['_CFG']['article_number']; $res = $GLOBALS['db']->getAll($sql); $arr = array(); foreach ($res AS $idx => $row) { $arr[$idx]['id'] = $row['article_id']; $arr[$idx]['title'] = $row['title']; $arr[$idx]['short_title'] = $GLOBALS['_CFG']['article_title_length'] > 0 ? sub_str($row['title'], $GLOBALS['_CFG']['article_title_length']) : $row['title']; $arr[$idx]['cat_name'] = $row['cat_name']; $arr[$idx]['add_time'] = local_date($GLOBALS['_CFG']['date_format'], $row['add_time']); $arr[$idx]['url'] = $row['open_type'] != 1 ? build_uri('article', array('aid' => $row['article_id']), $row['title']) : trim($row['file_url']); $arr[$idx]['cat_url'] = build_uri('article_cat', array('acid' => $row['cat_id'])); } return $arr; } 也放到init.php 里面 保存 亲缓存 OK 补充:还得把index.php中的 $smarty->assign('new_articles', index_get_new_articles()); 和 function index_get_new_articles() { $sql = 'SELECT a.article_id, a.title, ac.cat_name, a.add_time, a.file_url, a.open_type, ac.cat_id ' . ' FROM ' . $GLOBALS['ecs']->table('article') . ' AS a, ' . $GLOBALS['ecs']->table('article_cat') . ' AS ac' . ' WHERE a.is_open = 1 AND a.cat_id = ac.cat_id AND ac.cat_type = 1' . ' ORDER BY a.article_type DESC, a.add_time DESC LIMIT ' . $GLOBALS['_CFG']['article_number']; $res = $GLOBALS['db']->getAll($sql); $arr = array(); foreach ($res AS $idx => $row) { $arr[$idx]['id'] = $row['article_id']; $arr[$idx]['title'] = $row['title']; $arr[$idx]['short_title'] = $GLOBALS['_CFG']['article_title_length'] > 0 ? sub_str($row['title'], $GLOBALS['_CFG']['article_title_length']) : $row['title']; $arr[$idx]['cat_name'] = $row['cat_name']; $arr[$idx]['add_time'] = local_date($GLOBALS['_CFG']['date_format'], $row['add_time']); $arr[$idx]['url'] = $row['open_type'] != 1 ? build_uri('article', array('aid' => $row['article_id']), $row['title']) : trim($row['file_url']); $arr[$idx]['cat_url'] = build_uri('article_cat', array('acid' => $row['cat_id'])); } return $arr; } 删掉 |
最近更新
常用插件
- ecshop二次开发商品购买增
图片1香...
- ecshop2.7.2生成虚拟订单2.
以前我们开发过ecshop下的虚拟订单,就是客户在访问的时候,会自动生...
- ecshop2.7.1邮件发送插件
ecshop2.7.1邮件发送插件:该插件主要的开发思想是源于ecshop短信发送系统...
- ecshop最小购买数量控制插
ecshop最小购买数量控制插件,这个插件主要是为我们提供一个十分方便...
- ecshop没登陆情况下订单查
ecshop没登陆情况下订单查询插件,主要是针对ecshop在没有登陆的情况下...
ecshop热门问答
ecshop热门资料
ecshop红包不限使用次数
ecshop送客
ecshop卓流应用网
ecshop主题
ecshop边栏
ecshop童装
ecshop法登
ecshop提交后
ecshop北京招聘
ecshop专版
ecshop边距
ecshop叠现
ecshopmedium
ecshop单位换算
ecshopcomsenz
ecshop客服中心
ecshop开网店
ecshop文章
ecshop文件结构
ecshop虚拟点卡
ecshop管理设置
ecmall排行
ecshopSunnyV
ecshop利率
ecshop最低
ecshop创始人
ecshopGCOGO
ecshopECshop分类树
ecshopECSHOP图片生成
ecshop商品关联