您的位置:首页 > Web前端 > JavaScript

ECSHOP 首页主广告管理 Flash替换成其他js效果的修改

2015-12-11 15:34 736 查看
把这个函数插入到index.php中最下面即可,

function get_index_ad(){

        $sql = 'SELECT ad_type, content,ad_name,url FROM ' . $GLOBALS['ecs']->table("ad_custom")  ;

                $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中定义一个标签即可(不过到时候后台添加图片是在首页主广告那里自定义添加)

$smarty->assign('index_adlist',      get_index_ad());

然后在DWT文件中引用即可

如:<!--{foreach from=$index_adlist item=ads}-->

        <li><a target="_blank" href="{$ads.url}"><img src="{$ads.content}" alt="{$ads.ad_name}"></a></li>

        <!--{/foreach}-->

循环来自标签'index_adlist'      其中url为图片链接地址 content为图片 ad_name为图片名称
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php ecshop