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.

Feedback on the framework in prep for Zen Grid v3

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

Sorry this has taken so long. Too busy to think @_@

The feature in AMM seems to completely remove the content but not effect the result of countModules().

If enabled the content of an "empty" module appears to be truly empy - no .moduletable divs outputted etc. but if its the only module in say the left position the zenframework still fully opens the left position.

It would be useful if as an option (I can see it being unnecessary resource use otherwise) if the zenframework could hide "empty" modules independent of AMM.

In my instance I have a module which only renders content at certain times of day but I can see others making use of this.
  • AppleOrphanage's Avatar
  • AppleOrphanage
  • 6 Month Developer
  • 41 posts
  • 1 Thanks
  • Karma: 0
The administrator has disabled public write access.
I have to admit that in my opinion, what you are suggesting would mean that framework should add additional overload on web server and web site load because it would need to parse module output and check if it is empty. And how to define empty in this case? Some module could remove visible content but leave markup that would still be present in HTML source code but hidden from frontend (for example using display:none or something like that). That module wouldn't be parsed as empty.

AMM have additional features that can set module to be published only in certain time of the day for example. In case it doesn't need to be published, it won't be at all so that will in effect make this module position empty and it shouldn't be visible at all
  • mihha's Avatar
  • mihha
  • 12 Month Developer
  • 711 posts
  • 44 Thanks
  • Karma: 11
The administrator has disabled public write access.
Perhaps - I've added a suggestion to ideas.joomla.org as I think that countModules() could be a little ore intelligent... BUT if the framework stored the render data in a var it wouldn't change anything as it has to render the modules anyway.?

In my case I cannot add specific enough time/date publishing controls via AMM and simply wrote my own in a custom module.

As I said I added this logic to test if empty with AMM "hide if empty" enabled

trim( JModuleHelper::renderModule(array_shift(JModuleHelper::getModules( 'right' ))) ) == "")


Ideally I suppose would be Joomla's Moudle Manager allowing a param to be be set for individual modules like

renderBeforeCount/hideIfEmpty

which indicated that countModules() should render that specific module before counting it. What do you think?
  • AppleOrphanage's Avatar
  • AppleOrphanage
  • 6 Month Developer
  • 41 posts
  • 1 Thanks
  • Karma: 0
Last Edit: 12 years 7 months ago by AppleOrphanage.
The administrator has disabled public write access.
I think that I am not developer good enough to comment on this but from my perspective your way doesn't render module as empty because module can't hide itself in case it doesn't produce normal content. As soon as you publish custom module, it is not empty anymore. This publishing logic must be done in module manager. I am not sure why AMM doesn't work for you as expected but I can assure you that it works perfectly. Maybe you should contact AMM developer regarding this?
  • mihha's Avatar
  • mihha
  • 12 Month Developer
  • 711 posts
  • 44 Thanks
  • Karma: 11
The administrator has disabled public write access.
I don't think you quite understand what I am try to say.

AMM does hide the module content correctly BUT zenframework still alters its output as if the module is being rendered.

For example if an empty module is in the left position (and its the only one in the left position) zenframework alters the #midCol 's class to allow room for the left column BUT the left column is empty...

This cannot be changed by AMM.

I'm afraid I don't understand about the "module can't hide itself." I have a working example where based on PHP conditionals (inside the module) the module simply outputs nothing which triggers the AMM "hide if empty" which in turn is caught by my edit to zengridframework/functions/vars.php
  • AppleOrphanage's Avatar
  • AppleOrphanage
  • 6 Month Developer
  • 41 posts
  • 1 Thanks
  • Karma: 0
The administrator has disabled public write access.
As I said, I am afraid that I am not a developer good enough (you can call me season developer) to give you proper answer to this dilemma. I will have to leave this to Anthony to tell you what can be done and if it will be done :blush:
  • mihha's Avatar
  • mihha
  • 12 Month Developer
  • 711 posts
  • 44 Thanks
  • Karma: 11
The administrator has disabled public write access.
For example if an empty module is in the left position (and its the only one in the left position) zenframework alters the #midCol 's class to allow room for the left column BUT the left column is empty...

So in this case you would like the framework to test if it's empty or not and then determine the layout to use.

Basically the way we test for modules as you know is using countmodules() we do have a slightly modified function there as well but I think it all happens after the modules are parsed.

I do understand what you are sayign though and I wonder if the current line of logic to test if we need to print a row can be modified slightly.
$header = ($this->countModules('header2')?1:0)+ ($this->countModules('header3')?1:0)+ ($this->countModules('header4'));

Then add a function to test if the count returns content or not.

In fact this looks like a potential solution:

forum.joomla.org/viewtopic.php?f=304&t=401326

but I agree with Mihha that adding this to all modules will reduce the framework performance.
  • 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