if statement not working

2 posts by 2 authors in: Forums > CMS Builder
Last Post: July 1, 2010   (RSS)

By pod9 - July 1, 2010

Hi, I am trying to setup a feature where if some villas have special offers then they are shown but if there are no special offer some text is shown instead. However, the text is appearing weather special offers are available or not.

Here is a URL where you can see the special offers, and the text - http://www.ibizaedgevillas.com/holiday-rentals/offers-feed-villas_BACKUP.php

And below is the code that I am trying to use (note it is being used as a SSI on this site http://www.ibizaedgevillas.com in the right hand column):

<?php

require_once "/home/fhlinux130/i/ibizaedgevillas.com/user/htdocs/cmsAdmin/lib/viewer_functions.php";[/#004080]

list($villas_for_rentRecords, $villas_for_rentMetaData) = getRecords(array(
'tableName' => 'villas_for_rent',
'limit' => '20',
'orderBy' => 'createdDate DESC',
'allowSearch' => false,
));[/#004080]

?>
<?php foreach ($villas_for_rentRecords as $record): ?>
<?php foreach ($record['image'] as $upload): ?>
<?php if ($record['special_offer']): ?>
<a href="<?php echo $record['_link'] ?>"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="<?php echo $upload['info1'] ?>" border="0"/></a>
<?php endif ?>
<?php endforeach ?>[/#004080]

<?php if ($record['special_offer']): ?>
<span class="villaintro"><?php echo $record['special_offer'] ?> <?php echo $record['beds'] ?> bedrooms.</span><br>
<a href="<?php echo $record['_link'] ?>"><b>view villa details...</b></a>
<br><br>
<?php endif ?>
<?php endforeach ?>

<?php if (!$record['special_offer']): ?>
Ibiza Edge Villa Rental have regular special offers on our excellent portfolio of Ibiza holiday villas. For details about our current offers or for help with anything else please feel free to contact us on +44 (0)113 370 9299 (UK) / 0034 661 121 289 (Ibiza) or alternatively use our <a href="[/#004080][url "http://www.ibizaedgevillas.com/contact.php">contact"]http://www.ibizaedgevillas.com/contact.php">contact[/#004080][/url] form</a>.
<?php endif ?>[/#004080]

<?php if (!$villas_for_rentRecords): ?>
There are no villas available in this category at present.
<?php endif ?>[/#004080]
Pod9