How to place holding text

7 posts by 3 authors in: Forums > CMS Builder
Last Post: March 13, 2013   (RSS)

By KCMedia - March 12, 2013

Hi

I have this piece of code

                                    <div class="list">
                                        <ul>
                                            <?php if($record['ra_1'] != "0") { ?>
                                            <li>
                                                <span>No Reviews Currently Avaliable</span>
                                            </li>
                                            <?php } ?>
                                            <?php if($record['ra_1'] != "") { ?>
                                            <li>
                                                <span><?php echo $record['ra_1']; ?></span>
                                            </li>
                                            <?php } ?>
                                            <?php if($record['ra_2'] != "") { ?>
                                            <li>
                                                <span><?php echo $record['ra_2']; ?></span>
                                            </li>
                                            <?php } ?>
                                            <?php if($record['ra_3'] != "") { ?>
                                            <li>
                                                <span><?php echo $record['ra_3']; ?></span>
                                            </li>
                                            <?php } ?>
                                        </ul>
                                    </div>

what i want to do is if there is nothing in the ra_1 field to display some text in its place how can i do this.

Thanks



Craig

KC Media Solutions

www.kcmedia.biz

By KCMedia - March 13, 2013

Hi Equinox

thanks for that but i tried that and it didnt work for me either.

This is a detail page for a multi section

Thanks



Craig

KC Media Solutions

www.kcmedia.biz

By Dave - March 13, 2013

Hi kcmedia, 

Try this:

<div class="list">
  <ul>
    <?php if ($record['ra_1']): ?>
      <li><span><?php echo $record['ra_1']; ?></span></li>
    <?php else: ?>
      <li><span>No Reviews Currently Avaliable</span></li>
    <?php endif ?>
  
    <?php if ($record['ra_2']): ?>
      <li><span><?php echo $record['ra_2']; ?></span></li>
    <?php endif ?>
  
    <?php if ($record['ra_3']): ?>
      <li><span><?php echo $record['ra_3']; ?></span></li>
    <?php endif ?>
  <li>
</div>

And if that doesn't work, post the output of this: 

<?php showme($record); ?>

Let me know how it goes.

Dave Edis - Senior Developer
interactivetools.com

By KCMedia - March 13, 2013

Hi Dave

perfect thank you worked great.

Thanks



Craig

KC Media Solutions

www.kcmedia.biz

By Codee - March 13, 2013

Oh...a details page does not "normally" lists the record details with

<?php if ($record['ra_1']): ?>

but would use something like, if it were a details page for a section that had the name  'reviews'

<?php if ($reviewsRecord['ra_1']): ?>

and, no, the code I gave was 'general' and not geared for an unordered list, so maybe something like the following for a Details record for the reviews section, and supposing you had a class for those list items:

<div class="list">
  <ul>
    <?php if ($reviewsRecord['ra_1']): ?>
      <li><span class="reviewlist"><?php echo $record['ra_1']; ?></span></li>
    <?php else: ?>
      <li><span class="reviewlist">There is no available review for that piece, please check back later.</span></li>
    <?php endif ?>
  
    <?php if ($record['ra_2']): ?>
      <li><span class="reviewlist"><?php echo $record['ra_2']; ?></span></li>
       <?php else: ?>
      <li><span class="reviewlist">There is no available review for that piece, please check back later.</span></li>
    <?php endif ?>
  
    <?php if ($record['ra_3']): ?>
      <li><span class="reviewlist"><?php echo $record['ra_3']; ?></span></li>
       <?php else: ?>
      <li><span class="reviewlist">There is no available review for that piece, please check back later.</span></li>
    <?php endif ?>
  <li>
</div>

By Codee - March 13, 2013

doh! Dave had replied already. Sorry.