ecshop模板制作教程:不间断滚动的发货通知
打开根目录下的index.php,找到:
$smarty->assign('invoice_list',index_get_invoice_query()); // 发货查询
在下面添加一行:
$smarty->assign('post_list',index_get_post_query()); // 发货通知
再找到:
//-- PRIVATE FUNCTIONS
在下面添加以下代码:
function index_get_post_query()
{
$sql = 'SELECT order_sn, user_name,action_note FROM ' .$GLOBALS['ecs']->table('order_info') . ' JOIN (' .$GLOBALS['ecs']->table('users') . ',' .
$GLOBALS['ecs']->table('order_action') . ') ON (' .$GLOBALS['ecs']->table('users') . '.user_id=' .$GLOBALS['ecs']->table('order_info') .'.user_id
AND ' . $GLOBALS['ecs']->table('order_action') .'.order_id=' . $GLOBALS['ecs']->table('order_info'). '.order_id) WHERE ' . $GLOBALS['ecs']->table
('order_info') . '.shipping_status = 1 ORDER BY shipping_time DESCLIMIT 10';
$postinfo = $GLOBALS['db']->getAll($sql);
clearstatcache();
return $postinfo;
}
3、在使用模板里面的library目录里,新建一个post_list.lbi的文件,把以下代码复制到这个文件里面去!<meta http-equiv="Content-Type" content="text/html;charset=gbk">
<DIV id=demo style="overflow:hidden;height:220px;width :200px;">
<DIV id=demo1>
<!-- 发货公告{foreach from=$post_list item=post}-->
<fontcolor=red>{$post.user_name}</font>您好,您所购物品将于 <fontcolor=red>{$post.action_note}
</font>发出,我们预先短信通知您,请注意查收!<br>---------------------------------<br>
<!-- 发货公告{/foreach}-->
</DIV>
<DIV id=demo2>
</DIV>
</DIV>
</DIV>
<SCRIPT>
var speed=100
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetTop-demo.scrollTop<=0)
demo.scrollTop-=demo1.offsetHeight
else{
demo.scrollTop++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function(){clearInterval(MyMar)}
demo.onmouseout=function(){MyMar=setInterval(Marquee,speed)}
</SCRIPT>
4、然后打开index.dwt,在相关位置加代码:
<!-- #BeginLibraryItem "/library/post_list.lbi"--><!-- #EndLibraryItem-->

浙公网安备 33010602011771号