Hide empty autonavs
Permalink
Hey! I have an extra autonav called Sub-Nav on EVERY page in my site, so if the page "gets children" the children automatically shows up in Sub-Nav.
Now, is there a way to hide the <ul id="subnav"></ul> if there is no <li> inside it? This is only because I want my site to validate as xhtml strict.
Thank you!
Now, is there a way to hide the <ul id="subnav"></ul> if there is no <li> inside it? This is only because I want my site to validate as xhtml strict.
Thank you!
Same problem here...
Any ideas are appreciated.
Regards,
André
Any ideas are appreciated.
Regards,
André
Is this extra <ul> added by C5 or manually by you?
This is what worked for me:
$c->getNumChildren counts up all the blocks in the collection; use the getTotalBlocksInArea method on the Area instance instead.
<?php /* top of page */ $subnav = new Area('Sub Nav'); ?> <?php /* later on page*/ if( $subnav->getTotalBlocksInArea($c) > 0 || $c->isEditMode() ): ?> <ul id="subnav"> <?php $subnav->display($c); ?> </ul> <?php endif; ?>
$c->getNumChildren counts up all the blocks in the collection; use the getTotalBlocksInArea method on the Area instance instead.
I've been experimenting with if "($_c->getNumChildren() == 1)" but I don't get it to work as it should.
Thanks in advance,
Alejandro