Hiding empty content areas

Permalink
I have a site with multiple optional editable areas. I could make 9 templates for the different combinations of these, but I would prefer to have one template that shows all the areas when edited, but only areas with blocks when viewed.

Pseudo code:

<? if($area_5->got_stuff() || $is_edit_mode ){?>
  <div class="area5">
    <? $area_5->show()?>
  </div>
<?}?>


Can I do this? How does my template know it is in edit mode? How do I how how many blocks an area has?

 
DanielVF replied on at Permalink Reply
Self answer:
$c->isEditMode() and $area->getTotalBlocksInArea()