Transferred from: http://www.upxinyuan.com/wangzhanjiaocheng/233_1.html?jdfwkey=76j463
**
* Get display name according to box type field
* @param $field Field name
* @param $value field values
* @param the Model ID of the $modelid field
*/
function box ($field, $value, $modelid = ") {
$fields = GetCache (' model_field_ '. $modelid, ' model ');
Extract (String2array ($fields [$field] [' setting ']);
$options = explode ("\ n", $fields [$field] [options]);
foreach ($options as $_k) {
$v = Explode ("|", $_k);
$k = Trim ($v [1]);
$option [$k] = $v [0];
}
$string = ";
Switch ($fields [$field] [' Boxtype ']) {
Case ' Radio ':
$string = $option [$value];
Break
Case ' checkbox ':
$value _arr = Explode (', ', $value);
foreach ($value _arr as $_v) {
if ($_v) $string. = $option [$_v]. ', ';
}
Break
Case ' SELECT ':
$string = $option [$value];
Break
Case ' multiple ':
$value _arr = Explode (', ', $value);
foreach ($value _arr as $_v) {
if ($_v) $string. = $option [$_v]. ', ';
}
Break
}
return $string;
}
The foreground calls this field using {box (' Fenlei ', $r [Fenlei], $modelid)}/*feilei as a multi-select field */
PHPCMS Multi-Select field Foreground call method