简体   繁体   中英

Count articles that are marked “featured on the index page” in joomla

I would like to be able to anticipate when the <jdoc:include type="component" /> is not returning any content.

Something like this:

<?php if( count(<jdoc:include type="component" />)>=1 ) : ?> 
 <jdoc:include type="component" />
<?php else :?>
 Sorry No Content
<?php endif ; ?>

Searched all over but can't find anything that speaks to this. Sorry if this is remedial.

I have this snippet for testing component load errors ... not sure if might work for you

<?php if ($this->getBuffer('message')) : ?>  
 <div class="error">  
<h2> Message </h2>
<jdoc:include type="message" />
</div>
<?php endif; ?>
<jdoc:include type="component" />

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM