"Read More" link dependant on area/block empty
Permalink
Creating news item on "blog-like" page-type containing two fields for content:
Some news are short, with contents only in 'Main'. The page list template for the listing of all news contains this code:
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
... <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:
<?php 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"> <?php for ($i = 0; $i < count($cArray); $i++ ) { $cobj = $cArray[$i]; $target = $cobj->getAttribute('nav_target'); if ($cobj->getCollectionPointerExternalLink() != '') { if ($cobj->openCollectionPointerExternalLinkInNewWindow()) {
Viewing 15 lines of 74 lines. View entire code block.
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
replace
with
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.