Warning: Undefined array key "night" in /www/wwwroot/dhaomu.com/wp-content/themes/b2/header.php on line 18

EcShop调用后台指定广告位下所有广告循环

ecshop教程:ecshop调用后台指定广告位下所有广告循环!我们在ecshop模板制作当中,有时候对广告的调用不能局限于默认的ecshop的表情规则,比如要调用后台指定广告位下所有广告循环,如何处理呢?

ecshop教程:ecshop调用后台指定广告位下所有广告循环!我们在ecshop模板制作当中,有时候对广告的调用不能局限于默认的ecshop的表情规则,比如要调用后台指定广告位下所有广告循环,如何处理呢?

抽空做了个函数:

function get_position_ads($id)
{
    $sql = "select * from " . $GLOBALS['ecs']->table('ad') . " where position_id = ".$id." AND enabled = 1 order by ad_id";
    $rows = $GLOBALS['db']->getAll($sql);
    if($rows )
    {
     $sql = "select ad_width,ad_height from " . $GLOBALS['ecs']->table('ad_position') . " where position_id = ".$id." limit 1";
     $ad_position = $GLOBALS['db']->getRow($sql);
     foreach($rows as &$row )
     {
     $row['pic']= 'data/afficheimg/'.$row['ad_code'];
     $row['width'] = $ad_position['ad_width'];
     $row['height'] = $ad_position['ad_height'];
     }
    }
    return $rows;
}

然后显示页加入

$smarty->assign('dhaomu', get_position_ads(1)); 

模板里引入:

{foreach from=$dhaomu item=zuimobanlist}
<td><a href="{$dhaomulist.ad_link}" title="{$dhaomulist.ad_name}" target="_blank"><img src="{$dhaomulist.pic}" width="980" height="387" alt="{$dhaomulist.ad_name}" /></a></td>
                {/foreach}

至此模板上调用指定广告位就正常显示了。 以后只需改指定广位下广告就行。

温馨提示:
1.本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:duhaomu@163.com,我们将第一时间处理!
2.资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持。
3.所有资源仅限于参考和学习,版权归原作者所有,更多请阅读网站声明

给TA赞赏
共{{data.count}}人
人已赞赏
编程技巧

织梦图集多缩略图模式调用缩略图

2022-12-7 0:00:00

编程技巧

织梦教程DedeCMS系统标签{dede:flink /}用法及添加limit属性

2022-12-19 0:00:00

0 条回复 A文章作者 M管理员

Warning: Trying to access array offset on value of type null in /www/wwwroot/dhaomu.com/wp-content/themes/b2/functions.php on line 3914

Warning: Trying to access array offset on value of type null in /www/wwwroot/dhaomu.com/wp-content/themes/b2/functions.php on line 3914
----《》
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索