http://www.phpropertydeals.com/
Heres the website.. When im filtering all the property it works but when nothing just only a blank page? how can i add "no result found".
----------------------- here's the function filter ----------------------
function filter_propertytype($text){
switch($text){
case "commercial" :
echo "Commercial";
break;
case "condo-apartment" :
echo "Condo / Apartment";
break;
case "condotel-serviced-apartment" :
echo "Condotel / Serviced Apartment";
break;
case "house-and-lot" :
echo "House and Lot";
break;
case "lot-only" :
echo "Lot Only";
break;
case "office-space" :
echo "Office Space";
break;
case "resort-leisure" :
echo "Resort / Leisure";
break;
case "townhouse" :
echo "Townhouse";
break;
}
}
function filter_salerent($ text){ 开关($文本){ 案例"出租" : echo" For Rent&#34 ;; 打破; 案例"待售" : echo" For Sale&#34 ;; 打破; } }
--- here's the landing page if no result found if there's no result just a blank page how can i add no result found?? to this codes --
<?php
$mypost = array( 'post_type' => 'condo');
$loop = new WP_Query( $mypost );
?>
-------这里使用的表格请查看网站链接,这样你就可以看到我试图解释的内容请帮忙! ---
<input input name="propname" class="text-field-input" placeholder="Property name">
<input input name="propid" class="text-field-input" placeholder="Property ID">
<select input name="dev" class="select-field-input" placeholder="Developer">
<option value="">Any Developer</option>
<?php
$res = get_cat_array('developer');
foreach( $res as $rindx => $rval){
echo "<option value='" . $rval->slug . "' >" . $rval->name . "</option>";
}
?>
</select>
<select input name="pt" class="select-field-input" placeholder="Property Type">
<option value="">Any Property Type</option>
<?php
$res = get_cat_array('property_type');
foreach( $res as $rindx => $rval){
echo "<option value='" . $rval->slug . "' >" . $rval->name . "</option>";
}
?>
</select>
<select input name="sale" class="select-field-input" placeholder="Sale Type">
<option value="">Any Sale Type</option>
<?php
$res = get_cat_array('sale_type');
foreach( $res as $rindx => $rval){
echo "<option value='" . $rval->slug . "' >" . $rval->name . "</option>";
}
?>
</select>
<select name="location" class="select-field-input" placeholder="Location">
<option value="">Any Location</option>
<option>Caloocan</option>
<option>Las Pinas</option>
<option>Makati</option>
</select>
<select name="salerent" class="select-field-input" placeholder="Sale / Rent">
<option value="">For Sale & For Rent</option>
<?php
$res = get_cat_array('sale_or_rent');
foreach( $res as $rindx => $rval){
echo "<option value='" . $rval->slug . "' >" . $rval->name . "</option>";
}
?>
</select>
<select name="bedroom" class="select-field-input" placeholder="Number of Bedrooms">
<option value="">Any Number of Bedrooms</option>
<?php
$res = get_cat_array('no_of_bedrooms');
foreach( $res as $rindx => $rval){
echo "<option value='" . $rval->slug . "' >" . $rval->name . "</option>";
}
?>
</select>
<div class="mini-field">
<input input name="pricefrom" class="txt-field-input-mini formattingNumber" placeholder="Price from">
<input input name="priceto" class="txt-field-input-mini formattingNumber" placeholder="Price to">
</div>
<button type="submit" class="start-search-btn">Start Search<img src="<?php echo get_template_directory_uri();?>/images/search-img-white.png" alt="Start Search" class="start-search-img"/></button>
</form>
答案 0 :(得分:1)
case "townhouse" :
echo "Townhouse";
break;
default: 'No result found';
使用default
声明中的switch
参数。