File: View/result.tpl.php

Recommend this page to a friend!
  Classes of Pierre-Henry Soria  >  Free Text Search  >  View/result.tpl.php  >  Download  
File: View/result.tpl.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Free Text Search
Search for data taking common words typed by users
Author: By
Last change:
Date: 1 year ago
Size: 1,533 bytes


Class file image Download
 * @author Pierre-Henry Soria <>
 * @copyright (c) 2015, Pierre-Henry Soria. All Rights Reserved.
 * @license CC-BY -
 * @link

 * Since PHP 5.4, the echo short tag "<?= ?> is always available, so I use it to simplify the visibility of the template.
 * I also use the alternative PHP syntax that is much more clearly in template files.
if (empty($this->mSearch) || !$this->mSearch): ?>
<p class="warning">Whoops! You have to specify a "Rental" or "Sale" property. Please <a href="./?c=main&a=index">try again</a>!</p>

<?php else: ?>

    <?php $oResults = $this->mSearch->results // Store "results" attribute in a variable ?>

    <?php if($oResults->pagination->total_results > 0): ?>
        <?php foreach ($oResults->ads as $oAd):?>
<li><?=ucfirst($oAd->property_type)?> in <?=$oAd->general_area?> - <a href="<?=$oAd->daft_url?>" title="<img src=<?=$oAd->small_thumbnail_url?>>"><?=$oAd->full_address?></a></li>
        <?php endforeach ?>
    <?php else: ?>
<p class="warning">Whoops! Any proprety has been found. Please <a href="./?c=main&a=index">re-try</a>.</p>
    <?php endif ?>

<?php endif ?>

<h4 class="s_tMarg">Want to <a href="./?c=main&a=index">make a new search</a>?</h4>

<?php if (!empty($this->aParamResults)): ?>
<h3>Property Results Set</h3>
    <?php var_dump($this->aParamResults) ?>
endif ?>

For more information send a message to info at phpclasses dot org.