First step:
Add two functions to 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 = "<select name=". $name. " ><option value= > All </option> ";
$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) {
$title. = "<option value=". $n. "Selected>". $v. " </option> ";
}
else{
$title. = "<option value=". $n. " > ". $v." </option> ";
}
}
$title. = "</select>";
return $title;
}
The first function means filtering a space carriage return
The second function generates a Drop-down list based on the name (custom field) TB (owning model) $fid (the currently selected ID).
Step Two:
$day = Isset ($day) in the module/sell/search.inc.php? Intval ($day): 0; Insert below
$chengse = Isset ($CHENGSE) intval ($CHENGSE): 0;
In the IF ($VIP) $condition. = "and vip>0";
if ($CHENGSE) $condition. = "and chengse= $chengse";
Then use in the template file:
{Select_search (Chengse,sell, $chengse)}