The first step:
Add two functions to the include/global.fun.php
Function One:
function Losespace ($pcon) {$pcon = Preg_replace ("//", "", $pcon) $pcon = Preg_replace ("//", "", $pcon); $pcon = Preg_ Replace ("//", "", $pcon), $pcon = Preg_replace ("/\r\n/", "" ", $pcon); $pcon = Str_replace (CHR)," ", $pcon); $pcon = Str_ Replace (CHR), "", $pcon), $pcon = Str_replace (Chr (9), "", $pcon); return $pcon;}
Function Two:
function Select_search ($name, $TB, $fid) { global $db; $title = "All "; $r = $db->get_one ("select Option_value from {$db->pre}fields WHERE name= ' $name ' and tb= ' $TB '"); $option _value=losespace ($r ["option_value"]); $ps = Split ("\*", $option _value); #var_dump ($MATCHS); foreach ($ps as $s) { //split 1| available *=> 1, available if (! $s) { continue; } List ($num, $word) = Split ("\|", $s); $result [$num] = $word; } foreach ($result as $n = + $v) { if ($n = = $fid) { ". $v." "; } else{ ". $v." "; } } $title. = ""; return $title;}
The first function means filter blanks to enter
The second function generates a drop-down list based on the name (custom field) TB (owning model) $fid (currently selected ID).
Step Two:
On the module/sell/search.inc.php of the "= Isset" ($day)? Intval ($day): 0; Next insert
$chengse = Isset ($CHENGSE)? Intval ($CHENGSE): 0;
In the IF ($VIP) $condition. = "and vip>0";
if ($CHENGSE) $condition. = "and chengse= $chengse";
Then use it in the template file:
{Select_search (Chengse,sell, $chengse)}