您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程

ecshop出现Call to undefined function insert_ads()的解决方法

痴梦2024-01-20 23:13:40ecshop商城教程已有人查阅

导读ECShop Fatal error: Call to undefined function insert_ads() in includes/cls_template.php on line 1157 报错解决方法

ECShop Fatal error: Call to undefined function insert_ads() in includes/cls_template.php on line 1157 报错解决方法
删除这句话即可
还有一种解决方法:新建立一个PHP文件,命名为:ecshop119.php 文件内容为:
<?php
if (!defined('IN_ECS'))
{
die('Hacking attempt');
}
function insert_bought_notes($arr)
{
$need_cache = $GLOBALS['smarty']->caching;
$need_compile = $GLOBALS['smarty']->force_compile;
$GLOBALS['smarty']->caching = false;
$GLOBALS['smarty']->force_compile = true;
$sql = 'SELECT er_name, og.goods_number, oi.add_time,
IF(oi.order_status IN (2, 3, 4), 0, 1) AS order_status ' .
'FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS oi LEFT JOIN ' . $GLOBALS['ecs']->table('users') . ' AS u ON er_id =
er_id, ' . $GLOBALS['ecs']->table('order_goods') . ' AS og ' .
'WHERE oi.order_id = og.order_id AND ' . time() . ' -
oi.add_time < 2592000 AND og.goods_id = ' . $arr['id'] . ' ORDER BY oi.add_time DESC LIMIT 5';
$bought_notes = $GLOBALS['db']->getAll($sql);
foreach ($bought_notes as $key => $val)
{
$bought_notes[$key]['add_time'] = local_date("Y-m-d G:i:s", $val['add_time']);
}
$sql = 'SELECT count(*) ' .
'FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS oi LEFT JOIN ' . $GLOBALS['ecs']->table('users') . ' AS u ON er_id =
ler_id, ' . $GLOBALS['ecs']->table('order_goods') . ' AS og ' .
'WHERE oi.order_id = og.order_id AND ' . time() . ' -
oi.add_time < 2592000 AND og.goods_id = ' . $arr['id'];
$count = $GLOBALS['db']->getOne($sql);
$pager = array();
$pager['page'] = $page = 1;
$pager['size'] = $size = 5;
$pager['record_count'] = $count;
$pager['page_count'] = $page_count = ($count > 0) ?
intval(ceil($count / $size)) : 1;;
$pager['page_first'] = "javascript:gotoBuyPage(1,$arr[id])";
$pager['page_prev'] = $page > 1 ?
"javascript:gotoBuyPage(" .($page-1). ",$arr[id])" : 'javascript:;'; $pager['page_next'] = $page < $page_count ?
'javascript:gotoBuyPage(' .($page + 1) . ",$arr[id])" : 'javascript:;'; $pager['page_last'] = $page < $page_count ?
'javascript:gotoBuyPage(' .$page_count. ",$arr[id])" :
'javascript:;';
$GLOBALS['smarty']->assign('notes', $bought_notes);
$GLOBALS['smarty']->assign('pager', $pager);
$val= $GLOBALS['smarty']->fetch('library/bought_notes.lbi');
$GLOBALS['smarty']->caching = $need_cache;
$GLOBALS['smarty']->force_compile = $need_compile;
return $val;
}
?>
再在文件cls_template.php中,在这个函数里引用上面这个文件即:
function insert_mod($name) // 处理动态内容
{
require_once(ROOT_PATH . 'includes/ecshop119.php');
list($fun, $para) = explode('|', $name);
$para = unserialize($para);
$fun = 'insert_' . $fun;
return $fun($para);
}
这样就不会报错了,希望遇到跟我相同问题的人,能有所帮助,呵呵!

本文标签:

很赞哦! ()

留言与评论 (共有 条评论)
验证码:

本栏推荐

相关标签