Joomla 1.5: $this->countModules returns 1 for Jumi module even when empty

636 Views Asked by At

Working on a site in Joomla 1.5! Typically when testing if a module position is empty in Joomla! I'd do something like this:

<?php if ($this->countModules('position')): ?>
    BEFORE
    <jdoc:include type="modules" name="position" style="xhtml" />
    AFTER
<?php endif; ?>

But in my case I have a jumi module that references external source of code. jumi module that references external source of code

In some situations it will be blank, which in that case, I don't want the BEFORE and AFTER bits showing either. But whenever I try running the above code, the before and after sections show up, because $this->countModules() returns 1 instead of 0.

I have "Hide if empty" set to "Yes" for the module, but that doesn't seem to help. hide if empty

I've even tried setting a return false; on the external source code but that doesn't seem to help either.

Does anybody have any suggestions?

1

There are 1 best solutions below

2
On BEST ANSWER

Hide if empty cannot hide the BEFORE and AFTER because it's in the count condition.And BEFORE and AFTER will only hide if no module is enabled for that position. So to hide these you'll have to put this content inside your module.And check the if empty condition. Let me know if it's not clear.