Jump to content

Sergei

Approved members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by Sergei

  1. If it will be intresting for someone.
    I have solved the problem, but desision is  rough a bit.

    Fatal error: Cannot redeclare Plugin_BannerTypeHTML_delivery_adRender() (previously declared in /var/www/adv/lib/OX/Extension/bannerTypeHtml/bannerTypeHtmlDelivery.php:31) in /var/www/adv/lib/OX/Extension/bannerTypeHtml/bannerTypeHtmlDelivery.php on line 31
    Jrf


    I added this check

    if ( ! function_exists('Plugin_BannerTypeHTML_delivery_adRender')) {}

    right into the file that contains Plugin_BannerTypeHTML_delivery_adRender

    Cause of the problem:

    Function OX_Delivery_Common_getFunctionFromComponentIdentifier.

    there is   :
      if (!function_exists($functionName)) {
            if (!empty($GLOBALS['_MAX']['CONF']['pluginSettings']['useMergedFunctions'])) {
                _includeDeliveryPluginFile('/var/cache/' . OX_getHostName() . '_mergedDeliveryFunctions.php');
            }
            if (!function_exists($functionName)) {
                _includeDeliveryPluginFile($GLOBALS['_MAX']['CONF']['pluginPaths']['plugins'] . '/' . implode('/', $aInfo)
                    . '.delivery.php');
                if (!function_exists($functionName)) {
                    _includeDeliveryPluginFile('/lib/OX/Extension/' . $aInfo[0] . '/' . $aInfo[0] . 'Delivery.php');
                    $functionName = 'Plugin_' . $aInfo[0] . '_delivery';
                    if (!empty($hook) && function_exists($functionName . '_' . $hook)) {
                        $functionName .= '_' . $hook;
                    }
                }
            }
        }

    There is no check on existing  another fuction, it is more correct:


                if (!function_exists($functionName)) {
                    $functionName = 'Plugin_' . $aInfo[0] . '_delivery';

                    if (!function_exists($functionName)) {
                        _includeDeliveryPluginFile('/lib/OX/Extension/' . $aInfo[0] . '/' . $aInfo[0] . 'Delivery.php');
                    }

                    if (!empty($hook) && function_exists($functionName . '_' . $hook)) {
                        $functionName .= '_' . $hook;
                    }
                }

     

    PS: I don't create issue about it on github, because there is same topic with admin's post , that i hadn't find before - Maybe this bug had been fixed already, but i don't have the newest version...

    Sorry for my english and maybe I've created this topic in wrong category.

  2. I don't know certanly is it right or not  I think, you have two variantes at last, if i understand what you mean:

    1) If you want to make the banner that will be like one single banner, I mean that you have the few banners and they should be recognized by your ad-system like unit, you can use html5 banners. These banners will include css/js that are responsible for your carousel.

    2) In other cases you can put this carousel right into the sourse code of your site, then create zone(or few zones) for it and then get the banners , for example for the asyncjs by this way:

    <ul class="carusel_banner_list">

    <li class='first'>

    <ins data-revive-zoneid="{{new created zone}}" data-revive-id="{{your_id}}"></ins>

    </li>

    <li class='third'>

    <ins data-revive-zoneid="{{new created zone}}" data-revive-id="{{your_id}}"></ins>

    </li>

    <li class='second'>

    <ins data-revive-zoneid="{{new created zone}}" data-revive-id="{{your_id}}"></ins>

    </li>

    </ul>

    <script async src="/asyncjs.php"></script>

    (if you don't know how to create or use a js slider, it is different question for other forums and internet sources).

    sorry for my english.

     

     

  3. I use asyncjs for including all banners on the page. I 've inserted "invoke code" and so on.. All zones are being collected and the standart js script sent this bunch of the zone ids to the server.

    Now I need use two kind of the html banners : 1) generic ; 2) html5 (zip); 

    When both kind of the baners  should be showed on the page  and the request is sent to asyncspc.php i get fatal error there:

    Fatal error: Cannot redeclare Plugin_BannerTypeHTML_delivery_adRender() (previously declared in /var/www/adv/lib/OX/Extension/bannerTypeHtml/bannerTypeHtmlDelivery.php:31) in /var/www/adv/lib/OX/Extension/bannerTypeHtml/bannerTypeHtmlDelivery.php on line 31

    After some debug i can add what i think:

    1) there is foreach in function OX_Delivery_Common_getFunctionFromComponentIdentifier  that processes all zone ids and include the files that is needed for rendering each kind of the banners.

    2) when zone with generic html banner is being processed  file plugins/bannerTypeHtml/oxHtml/html5.delivery.php is included.

    3) there is call of   _adRenderHtml in function Plugin_BannerTypeHTML_oxHtml_html5_Delivery_adRender in file html5.delivery.php

    4)_adRenderHtml  includes the file with function Plugin_BannerTypeHTML_delivery_adRender from that fatal error.

    5) after that html5(zip) banner is being processed and there is the second time when this function  is included 

    6) result is the fatal error.

    There is checking "function_exists" don't work because functions are included inside of the function. This way make "function_exists" to return "false".

    Quesiton: is it issue or I do something wrong with this functional

    Thanks.

    Sorry for my english, below the same explanation in russian.

    -------------------------
    Я использую asyncjs для того чтобы вывести все баннеры. Вставил "вызывающий код " и так далее.. В общем, все id зон собираются и с помощью одного запроса, так сказать, пачкой, отправляются на сервер.
    Теперь мне нужно на ровне с generic баннерами использовать html5(zip) баннеры, но когда на странице должны выводится оба вида этих баннеров у меня появляется ошибка при исполнении asyncspc.php.

    Fatal error: Cannot redeclare Plugin_BannerTypeHTML_delivery_adRender() (previously declared in /var/www/adv/lib/OX/Extension/bannerTypeHtml/bannerTypeHtmlDelivery.php:31) in /var/www/adv/lib/OX/Extension/bannerTypeHtml/bannerTypeHtmlDelivery.php on line 31

    Немного подебажил:

    1) в OX_Delivery_Common_getFunctionFromComponentIdentifier есть foreach который перебирает зоны и подключает нужные файлы с функциями для обработки того или иного вида 

    2) Когда обрабатывается зона для generic баннера подключается файл plugins/bannerTypeHtml/oxHtml/html5.delivery.php

    3) там функция вызывающая _adRenderHtml

    4) в _adRenderHtml подключается файл с той функцией из фатальной ошибки 

    5) затем обрабатывается html5 zip баннер и он подключает нужный для этого файл

    6) результат функция подключается дважды

    Проверка с function_exists здесь не работает так как подключение происходит внутри функции. Это заставляет function_exists вернуть false 

    Вопрос: это баг или я что-то делаю не так с этим asincjs?

×
×
  • Create New...