Support Forum

Please note that this forum is only available to you in read only mode. In order to contribute to this conversation you will need to renew your subscription.

hide module if empty

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

Hi,

This probably can fall with many templates but...

I am using Advanced Module Manager and I cannot get the module to hide if empty, ever. I have read that some templates need to add or edit code within the template modules.php to achieve this but I cannot find reference to anything recent, J3.6.

Thanks,
Helen
  • Helen Nunley's Avatar
  • Helen Nunley
  • LIfetime Developer - Big Bamboo
  • 1024 posts
  • 3 Thanks
  • Karma: 7
The administrator has disabled public write access.
Well, it seems that the modules do Hide if Empty but the module position still does not collapse so maybe this was just a misunderstanding on my part. :unsure:

www.regularlabs.com/forum/advancedmodulemanager/39709-having-trouble-with-hide-if-empty#!
  • Helen Nunley's Avatar
  • Helen Nunley
  • LIfetime Developer - Big Bamboo
  • 1024 posts
  • 3 Thanks
  • Karma: 7
The administrator has disabled public write access.
Hi Helen,

I'll need to check with Anthony on this and get back to you

Is there a particular reason you need to use this module from Peter?

Cheers
Paul
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
Hi Helen,

Long time no see :)

Yes there is no way for the modules.php fiel to talk to the parent files in this case. You could use javascript which would cause a small flash of the position as the page loads but not sure what else to suggest in that case.

Thanks!
  • Anthony Olsen's Avatar
  • Anthony Olsen
  • LIfetime Developer - Big Bamboo
  • 23925 posts
  • 788 Thanks
  • Karma: 433
The administrator has disabled public write access.
Thanks Anthony. Is this a joomla limitation, a template limitation, or something the developer of my module could overcome with programming?
  • Helen Nunley's Avatar
  • Helen Nunley
  • LIfetime Developer - Big Bamboo
  • 1024 posts
  • 3 Thanks
  • Karma: 7
The administrator has disabled public write access.
Hi Helen,

What type of module are you adding and to which position?

In general, I think amm works in the same way as standard module assignment, so if there are no modules in a position, the template knows that no modules should be outputted.

If the module itself doesn't provide any output in certain circumstances,, but is still assigned to a page and a position, then the theme would still output the position, even if the module doesn't provide any output.

You may be able to get around part of that by changing the module style to simple or none in the advanced tab of the module settings, but that would also remove any of the template styling of the position.

Regards,

Rob
  • Robert Went's Avatar
  • Robert Went
  • Moderator
  • 2210 posts
  • 196 Thanks
  • Karma: 90
The administrator has disabled public write access.
Actually thanks for the reminder Rob.

As far as I know the only way around it is to check the contents of the module first. Peter may have some helper that will do this, but that's the only way I could see it working.

forum.joomla.org/viewtopic.php?t=401326

That's an old post but covers part of what you need.

If it's just for one position then it would be relatively low overhead. But if you need to check for all I'd be looking at trying to do it some other way.
  • Anthony Olsen's Avatar
  • Anthony Olsen
  • LIfetime Developer - Big Bamboo
  • 23925 posts
  • 788 Thanks
  • Karma: 433
The administrator has disabled public write access.
The best way I can see to address this would be to place the module within an article if possible. Then when the output is null, the result is just a bit more white space within the article. Not as obvious an omission to the design.
  • Helen Nunley's Avatar
  • Helen Nunley
  • LIfetime Developer - Big Bamboo
  • 1024 posts
  • 3 Thanks
  • Karma: 7
The administrator has disabled public write access.
Yeah that might be a way around it. Wouldn't need any whitespace if you add some css to null any margins on any of the markup around the item.

Thanks
  • Anthony Olsen's Avatar
  • Anthony Olsen
  • LIfetime Developer - Big Bamboo
  • 23925 posts
  • 788 Thanks
  • Karma: 433
The administrator has disabled public write access.

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

Happy Campers