Ecshop 首页主广告修改为:JS 并带有排序功能

2009-10-09

一 查看效果:


二修改方法如下:

1 把library/index_ad.lbi 里代码替换成以下代码
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<script type="text/javascript" src="http://www.mfwine.cn/themes/Genuine/myFocus/myfocus-2.0.1.min.js"></script>
<script type="text/javascript">
//设置
myFocus.set({
        id:'myFocus',//ID
        pattern:'mF_pconline',//风格
        time:5//切换时间间隔(秒)
});
</script>
<div id="myFocus"><!--焦点图盒子-->
  <div class="loading"><img src="themes/Genuine/myFocus/loading.gif" alt="请稍候..." /></div><!--载入画面(可删除)-->
  <div class="pic"><!--图片列表-->
          <ul>
                <!--{foreach from=$index_adlist item=ads}-->
        <li><a target="_blank" href="{$ads.url}"><img src="{$ads.content}" alt="{$ads.ad_name}" /></a></li><!--{/foreach}-->
          </ul>
  </div>
</div>

2 修改index.php
在“?>”前加上以下代码:
function get_index_ad(){
    $sql = 'SELECT ad_type,content,ad_name,url,orderid FROM ' . $GLOBALS['ecs']->table("ad_custom") .'ORDER BY orderid ASC'  ;
    $res = $GLOBALS['db']->getAll($sql);
    $ads = array();
                foreach ($res AS $adx => $row)
                {
                        $ads[$adx]['ad_type']           = $row['ad_type'];
                        $ads[$adx]['content']           = $row['content'];
                        $ads[$adx]['url']               = $row['url'];
                        $ads[$adx]['ad_name']           = $row['ad_name'];
                }
                return $ads;
        }
在这段代码后
$smarty->assign('shop_notice', $_CFG['shop_notice']); // 商店公告
加入
$smarty->assign('index_adlist', get_index_ad());

3 在“ecs_ad_custom”表下增加一个字段“orderid”

4 修改admin/flashplay.php

5 修改后台模板 admin/templates 下的三个文件
flashplay_custom.htm
flashplay_custom_add.htm
flashplay_ccustom_edit.htm

4与5下载地址:https://www.028wz.net/mf.zip

本摘自:028工作室

扫描二维码分享到微信

在线咨询
联系电话

028-86728035