1

I'm using a template which uses the following code at the top end of the container.

<?php if ($this->countModules('advert')) : ?>
<div id="fav-verytop" class="container-fluid" >
    <jdoc:include type="modules" name="advert" style="icon" />
    <div class="row-fluid">
        <div id="fav-advert" class="span12">
            <jdoc:include type="modules" name="advert" style="icon" />
        </div>
    </div>
</div>

This code loads a module in the "advert" position correctly in Chrome, but Firefox and Android load the module twice. i.e. one at the very top left of the main container and once again in a fluid row just below the first loading.

Classes container-fluid and span12 are part of the Joomla bootstrap css. Demo site: Demo Any ideas will be appreciated. I've used Web Developer in Firefox and can see the various divs and css values etc. This has been a real brain freeze.

  • 2
    The module is loading twice because you're calling it twice with jdoc:include. If you dont want to load it twice, don't call it twice – Lodder Mar 17 '18 at 16:42
  • I'm aware of that, but if the css is set up correctly I believe that only one would be displayed. Chrome only displays once. That's what throws me off. If I comment out the first call, Firefox doesn't display. Comment the second one and Firefox displays. – Phil Schaming Mar 17 '18 at 17:31
  • 1
    Hint, disable your adblocker on Chrome ;) – Lodder Mar 17 '18 at 18:15
  • 1
    Then remove the second jdoc:include – Lodder Mar 17 '18 at 18:16
  • 1
    Feel free to write an answer and mark it as accepted – Lodder Mar 17 '18 at 21:44
0

The code as written was loading the module twice. The fix was to remove five lines of code to prevent the second load of the module. This is the final fixed code:

<?php if ($this->countModules('advert')) : ?>
<div id="fav-verytop" class="container-fluid" >
    <jdoc:include type="modules" name="advert" style="icon" />
</div>

The module now loads once as it should.

While using Chrome, the use of Ad Blocker prevented Chrome from displaying the module the second time which provide an anomaly which made the OP think it was a browser incompatibility rather than a code problem.

  • 1
    Try removing the <!-- Advert --> comment from your template's index.php file. This may prevent Adblockers from blocking the module – Lodder Mar 20 '18 at 13:23

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.