Calling "new Area('Auto_nav');" twice in page types doubles the output.
PermalinkIn order to avoid breaking his already existing design for displays 992px and over, I simply added a second header section with menu included, then toggled between the two using bootstrap's hidden classes. However, I have found that calling the same menu area causes the resulting list ('li') items to be repeated—example 'Home Contact About Home Contact About'. This is all in the same unordered list ('ul')!
Does anyone know what's going on? Is there a way for me to avoid this? Any advise on how to get around this behavior?
I haven't worked with concrete5 before this, so if I am making an obvious rookie mistake I apologize for the trouble. Just couldn't find anything on this problem.
Thank you for whatever insight you can provide!
It was a good idea though, thank you. :)
In the first nav spot put this
<?php $autoNav = new Area('Auto Nav'); if($c->isEditMode()){ $autoNav->display($c); } else { ob_start(); $autoNav->display($c); $navContent = ob_get_clean(); echo $navContent; } ?>
and in the second one put this
<?php if(!$c->isEditMode()){ echo $navContent; } ?>
Thanks so much for the assistance! :)
If the page is not in edit mode it captures the output and assigns it to the $navContent then echos that in each place. There is something as you stated with the display function of an area containing an Auto Nav that causes the Auto Nav to duplicate itself in a really weird way.
Thanks again for the help, and for following up with an explanation for your fix. I really appreciate it.
Then where you want to output the nav, just put this line in each place