Empty blocks
Permalink
Hi! I've learnt to use the code
That prints out the sidebar DIVs only if there is a blocks in this area.
Now I would wan't the sidebar to show up depending on if there's blocks in the Main-area, so instead of
I use
but I won't get it to work. Any ideas???
<?php $a = new Area('Sidebar'); if ($a->getTotalBlocksInArea($c) > 0) { ?> <div id="sidebar"> <?php $a->display($c); ?> </div> <?php } else { ?> <?php $a->display($c); ?> <?php } ?>
That prints out the sidebar DIVs only if there is a blocks in this area.
Now I would wan't the sidebar to show up depending on if there's blocks in the Main-area, so instead of
if ($a->getTotalBlocksInArea($c) > 0) { ?>
I use
if ($a->getTotalBlocksInArea('Main') > 0) { ?>
but I won't get it to work. Any ideas???
http://www.concrete5.org/help/building_with_concrete5/developers/mvc/scripting_common_concrete5_tasks/
$c = new Page::getByPath('/yourpagepath'); $blocks = $c->getBlocks("Main");
<div id="showcase">
<div id="showcase_inner" class="center_wrapper clearfix">
<?php
$a = new Area('Showcase');
$a->display($c);
?>
</div>
</div>
<?php
if ($a->getTotalBlocksInArea($c) > 0 ) {
?>
<style type="text/css">
#showcase { height:220px; display:block; }
</style>
<?php } ?>
Hope somebody can help me with this :(