ECSHOP模板 {insert name='history'}的用法
来源:互联网 发布:南风知我意陆西洲免费 编辑:程序博客网 时间:2024/04/29 14:56
在看ECSHOP代码的时候,在 history.lbi 中发现下面的用法。
{insert name='history'} ,是用来显示浏览历史的。
跟踪代码后发现,控制语句是在 includes/lib_insert.php 文件。
这个文件是ECSHOP 动态内容函数库。
里面定义各个函数的格式都是 function insert_***() ,每个函数都是一个功能控制模块,
在模板中可以使用 {insert name= ‘***' } 的方法进行调用。
/**
* 调用浏览历史
*
* @access public
* @return string
*/
function insert_history()
{
$str = '';
if (!empty($_COOKIE['ECS']['history']))
{
$where = db_create_in($_COOKIE['ECS']['history'], 'goods_id');
$sql = 'SELECT goods_id, goods_name, goods_thumb, shop_price FROM ' . $GLOBALS['ecs']->table('goods') .
" WHERE $where AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0";
$query = $GLOBALS['db']->query($sql);
$res = array();
while ($row = $GLOBALS['db']->fetch_array($query))
{
$goods['goods_id'] = $row['goods_id'];
$goods['goods_name'] = $row['goods_name'];
$goods['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
$goods['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
$goods['shop_price'] = price_format($row['shop_price']);
$goods['url'] = build_uri('goods', array('gid'=>$row['goods_id']), $row['goods_name']);
$str.='<ul class="clearfix"><li class="goodsimg"><a href="'.$goods['url'].'" target="_blank"><img src="'.$goods['goods_thumb'].'" alt="'.$goods['goods_name'].'" class="B_blue" /></a></li><li><a href="'.$goods['url'].'" target="_blank" title="'.$goods['goods_name'].'">'.$goods['short_name'].'</a><br />'.$GLOBALS['_LANG']['shop_price'].'<font class="f1">'.$goods['shop_price'].'</font><br /></li></ul>';
}
$str .= '<ul id="clear_history"><a onclick="clear_history()">' . $GLOBALS['_LANG']['clear_history'] . '</a></ul>';
}
return $str;
}
- ECSHOP模板 {insert name='history'}的用法
- ECSHOP模板中 {insert name='‘。。。'}的用法
- ecshop中{insert name='history'}修改方法
- ecshop {insert name=”}的使用
- ecshop 中{insert name='member_info'}及注意的细节。
- ecshop {insert} 标签的用法
- 修改ecshop中的{insert name='cart_info'}
- ECShop {insert name=’cart_info’}|insert_function|动态函数库
- 如何修改ecshop中的{insert name='cart_info'}
- ecshop模板中 foreach 的用法
- ecshop和ecstouch的insert标签的用法
- ECSHOP中INSERT函数的定义及用法
- ecshop的模板文件
- ecshop的模板函数
- history 的经典用法
- history的用法
- Ecshop模板开发(三):insert foreach if标签使用
- Ecshop模板中html_options用法详解
- mysql中查询表中某个字段重复出现次数
- node.js 操作Cookies
- 如果你把这篇文章读透,可能你的人生从此会变得有一些不同
- Ajax 入门实例
- Hough变换(openCV的cvHoughLines2)
- ECSHOP模板 {insert name='history'}的用法
- sqlServer 中使用sql语句实现固定分页功能
- dos 脚本使用
- FileObserver监听文件示例
- 大数据处理利器——基础概念
- 如何在 ActiveX 控件中使用字体
- 去掉identity列属性范例
- MySQL Cluster 与 MongoDB 复制群集分片设计及原理
- CSS定义Input之Radio和Checkbox的样式