Disappearing Content - theme php conflict with Layout?

Permalink
I've made a custom page type template that allows editors to add specifically styled segments of a page, but that don't show if there are no blocks placed in the segments. I used this code from the documentation:

<?php
   $a1 = new Area('Main');
   $block_count = $a1->getTotalBlocksInArea($c);
   if ($block_count > 0 || $c->isEditMode()) { ?>
   <div class="content white">
       <div class="section clearfix">
      <?php $a1->display($c); ?>
       </div>
   </div>
<?php } ?>


When I try to use the C5 Layout function within one of these however, the content disappears unless in edit mode. Is there some sort of inherent conflict here?

I did notice there were a couple reports of disappearing Layout content, but no responses so far.

Thanks.

Thanks.

Veronikan
 
Veronikan replied on at Permalink Reply
Veronikan
Found discussion and answers here:
http://www.concrete5.org/community/forums/usage/layout-makes-blocks...

This seems to work:
<?php
   $a1 = new Area('Main');
   $adump = $a->getAreaLayouts($c);
   if (($a->getTotalBlocksInArea($c) > 0) || !empty($adump) ||   ($c->isEditMode()) ) { ?>
   <div class="content white">
       <div class="section clearfix">
      <?php $a1->display($c); ?>
       </div>
   </div>
<?php } ?>