"Read More" link dependant on area/block empty

Creating news item on "blog-like" page-type containing two fields for content:
<h2><?php  echo $c->getCollectionName(); ?></h2>
<?php  $as = new Area('Main'); $as->display($c); ?>
<?php  $a = new Area('Blog Post More'); $a->display($c); ?> ...

Some news are short, with contents only in 'Main'. The page list template for the listing of all news contains this code:
   defined('C5_EXECUTE') or die("Access Denied.");
   $textHelper = Loader::helper("text");
   $date = Loader::helper("date");   
   // now that we're in the specialized content file for this block type, 
   // we'll include this block type's class, and pass the block to it, and get
   // the content
   if (count($cArray) > 0) { ?>
    <div class="news-index-contents">
   for ($i = 0; $i < count($cArray); $i++ ) {
      $cobj = $cArray[$i]; 
      $target = $cobj->getAttribute('nav_target');
      if ($cobj->getCollectionPointerExternalLink() != '') {
         if ($cobj->openCollectionPointerExternalLinkInNewWindow()) {

I will want to only display the "Read Full Post" link (around line 48 in the code) if 'Blog Post More' actually contains data, but as I'm a total n00b with PHP I am stuck.

An immediate working solution will be highly appreciated, as will links to any available "docs for dummys"

Thanks in advance

Søren, Denmark

View Replies: View Best Answer
12345j replied on at Permalink Best Answer Reply
Try this:
<a href="<?php   echo $link; ?>">Read full post »</a>

$a = new Area('Blog Post More');
if(!empty($arr)){ ?>
<a href="<?php   echo $link; ?>">Read full post »</a> 
<?php }?>

Basically, what you're doing is getting an array of all the blocks in the Blog Post More area on each blog post page. If this array has something in it, then display the read more link.
sokristi replied on at Permalink Reply
Did the trick, thanks a bunch. I had figured out that it was possible to display the block in question, but couldn't for the life of me figure out how to access it any other way.