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.

6
  • 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
    Commented Mar 17, 2018 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. Commented Mar 17, 2018 at 17:31
  • 1
    Hint, disable your adblocker on Chrome ;)
    – Lodder
    Commented Mar 17, 2018 at 18:15
  • 1
    Then remove the second jdoc:include
    – Lodder
    Commented Mar 17, 2018 at 18:16
  • 1
    Feel free to write an answer and mark it as accepted
    – Lodder
    Commented Mar 17, 2018 at 21:44

1 Answer 1

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
  • 1
    Try removing the <!-- Advert --> comment from your template's index.php file. This may prevent Adblockers from blocking the module
    – Lodder
    Commented Mar 20, 2018 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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