SEARCH RESULTS PAGE TELLTALES (THINK BREADCRUMBS) - Jan 3rd, 2014


I needed to create a telltale on a search results page to remind visitors of the search criteria they had entered in a
search form.

Everything in the telltale was pretty straight forward (I left the Status (a list field) search, and the all listings
search as an example) until I got to the listing age searches.

I wanted to be able to filter the results to only those listings that were created less than either 1, 2, or 3 months
ago, and the telltale was returning long date/time indicators instead of just how many months old the listings shown
would be.

With a lot of help from Dave Edis, Senior Developer at Interactive Tools, Here’s the solution we came up with:

<table width="40%" border="0" cellspacing="0" cellpadding="2">
<form method="POST" class="arial_14" action="listings-s.php">
<tr>
<td class="arial_14"><font color="#FFFFFF"><b>Show Listings: </b></font></td>
<td colspan="3"><select name = "status_match"width="300" class="arial_14" style="width: 300px" >
<option value="">All Listings</option>
<?php foreach (getListOptions('listing', 'status') as $value => $label4): ?>
<option value = "<?php echo $value;?>" <?php selectedIf($value, @$_REQUEST['status']);?>> <?php echo
$label4; ?></option>
<?php endforeach ?>
</select></td>
</tr>

<tr>
<td class="arial_14"><font color="#FFFFFF"><b>Date Listed: </b></font></td>
<td colspan="3">
<select name="months_ago" width="300" class="arial_14" style="width: 300px">
<option value="">All Dates</option>
<option value="1">Listed less than 1 Month ago</option>
<option value="2">Listed less than 2 Months ago</option>
<option value="3">Listed less than 3 Months ago</option>
</select>
</td>
</tr>
<tr>
<td class="arial_14"><b>&nbsp;</b> </td>
<td align="left" colspan="3"><input type="submit" name="submit" value="Search" ></td>
</tr>
</form>
</table>

And On The Results Page

<?php

if (@$_REQUEST['months_ago']) {
$monthsAgo = $_REQUEST['months_ago'];
$_REQUEST['createdDate_min'] = mysql_datetime(strtotime("-$monthsAgo month"));
}

?>


<?php
$searchCriteria = '';
if (@
$_REQUEST['status_match']) { $searchCriteria .= "Status: {$_REQUEST['status_match']} - "; }


if (@
$_REQUEST['months_ago']) { $searchCriteria .= "Listed Less Than: {$_REQUEST['months_ago']} months ago - "; }
$searchCriteria = chop($searchCriteria, ', '); // remove trailing , or spaces
$searchCriteria = chop($searchCriteria, '- '); // remove trailing - or spaces

?>

<div align="center"> <span class="arial_14"> There are <?php echo $listingMetaData['totalRecords']; ?> listings that
match your search for:
<?php if ( @!$searchCriteria ):?>
All Listings
<?php else :?>

<?php echo $searchCriteria ?>
<?php endif ?>
</span>

<a href="search.php"><span class="arial_14">
&lt;&lt; <u>Return to the Advanced Search Page</u></span></a></div>



The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service