How to remove “Read more” link, when field is empty

4 posts by 2 authors in: Forums > CMS Builder
Last Post: September 25, 2009   (RSS)

Re: [einslistir] How to remove “Read more” link, when field is empty

By gkornbluth - September 25, 2009

an if statement is one of the more powerful pieces of code.

You can use it so that if the article field is empty then it wont show your read more link.

The general layout for the code is:

In a single record viewer:

<?php if ($your_tableRecord['your_field']): ?> ...your code...
<?php endif ?>

Or in a multi record viewer:

<?php foreach ($your_tableRecords as $record): ?>
<?php if ($record['your_field']): ?> ...your code...
<?php endif ?>
<?php endforeach; ?>


See how that works...

Best,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] How to remove “Read more” link, when field is empty

By einslistir - September 25, 2009

Thank you very much! It works! [:)]

Re: [einslistir] How to remove “Read more” link, when field is empty

By gkornbluth - September 25, 2009

Great,

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php