• ecshop以幻灯版调用首页主广告显示


    默认的是index_ad.lbi模板有一个$flash变量了,但在搜索搜索没发现

    复制代码
    <!--{foreach from=$flash name=no item=flash}-->    <li class="li{$smarty.foreach.no.iteration}"><a href="{$flash.url}" target="_blank"><img src="{$flash.src}"/></li><!--{/foreach}--><!--{foreach from=$flash name=no item=flash}-->     <li>    {$smarty.foreach.no.iteration}    </li> <!--{/foreach}-->
    复制代码

    然后我在index.php文件搜索flash变量没有,只发现这样一个代码

    复制代码
    /* 首页主广告设置 */$smarty->assign('index_ad',     $_CFG['index_ad']);    if ($_CFG['index_ad'] == 'cus')    {        $sql = 'SELECT ad_type, content, url FROM ' . $ecs->table("ad_custom") . ' WHERE ad_status = 1';        $ad = $db->getRow($sql, true);        $smarty->assign('ad', $ad);}
    复制代码

    发现没办法使用了,我调用时也不会显示广告主的广告,于是网上搜索一下看到一段这样的文字

    在首页index.php的代码:$smarty->assign('shop_notice',     $_CFG['shop_notice']);       // 商店公告

    在这个代码下面加入下面代码:

    $smarty->assign("flash",get_flash_xml());$smarty->assign('flash_count',count(get_flash_xml()));

    如果以上两步没有调用首页主广告,然后再index.php中加入如下代码:

    复制代码
    /** * 首页显示主广告区所需代码 * @return array */function get_flash_xml(){    $flashdb = array();    if (file_exists(ROOT_PATH . DATA_DIR . '/flash_data.xml')) {        // 兼容v2.7.0及以前版本        if (!preg_match_all('/item_url="([^"]+)"slink="([^"]+)"stext="([^"]*)"ssort="([^"]*)"/', file_get_contents(ROOT_PATH . DATA_DIR . '/flash_data.xml'), $t, PREG_SET_ORDER)) {            preg_match_all('/item_url="([^"]+)"slink="([^"]+)"stext="([^"]*)"/', file_get_contents(ROOT_PATH . DATA_DIR . '/flash_data.xml'), $t, PREG_SET_ORDER);        }        if (!empty($t)) {            foreach ($t as $key => $val) {                $val[4] = isset($val[4]) ? $val[4] : 0;                $flashdb[] = array('src' => $val[1], 'url' => $val[2], 'text' => $val[3], 'sort' => $val[4]);            }        }    }    return $flashdb;}
    复制代码

    查看更多 ecshop教程 ecshop模板

  • 相关阅读:
    QT 界面刷新
    剑指 Offer 65. 不用加减乘除做加法
    3.nvidia-docker安装
    6.通过docker配置深度学习环境
    2.docker安装
    OSG+Visual Studio2015项目变量设置;
    Learning OSG programing---osgwindows
    日常学习网站推荐
    开发 MFC 应用的一般过程
    FVWM使用指南
  • 原文地址:https://www.cnblogs.com/qiao20/p/5627165.html
Copyright © 2020-2023  润新知