Test if block is empty and output default value, if true

Permalink
I'm aware of this (http://www.concrete5.org/community/forums/customizing_c5/check-if-block-is-empty/) related question, but it seems not really suitable to the problem I have.

Say you have some 'Header Image' area in your header.php and want to output a default header image, in case no image was assigned to a subpage of the website you are working on.

Isn't it possible to do just something like this:
$a = new Area('Header Image');
if( !empty($c) ) {
    $a->display($c);
} else {
    echo "Some default image";
}

imeos
 
cubewebsites replied on at Permalink Best Answer Reply
You could do this:

if($a->getTotalBlocksInArea($c)>0) {
$a->display($c);
else {
echo "Some other thing here (could even be another block";
}
imeos replied on at Permalink Reply
imeos
Thanks, that works and is not too ugly ;-)