大伙在解决织梦后台无法添加显示联动选项后,发现提交表单后,后台枚举值只显示数字。下面就来解决这个问题,让提交到后台的数据显示文字。
下面是修改方法:
1.在”后台目录”\templets\diy_list.htm找到如下代码:
else if($fielddata[1]=='addon'){$fields[$field] = " 其它附件";}
在下面加入:
//联动类型显示修正开始 else if($fielddata[1]=='stepselect') { $db->Execute('me',"SELECT * FROM `dede_stepselect` WHERE itemname='{$fielddata[0]}'"); while($arr = $db->GetArray(me)) { $egroup = $arr['egroup']; } $fields[$field] = Getenums("https://www.liuzhongwei.com/a/dedejq/{$fields[$field]}",$egroup); }
2.继续这个文件向下找到:
{/dede:datalist}
在下面加入:
=500){if($evalue % 500 == 0){return (isset($GLOBALS['em_'.$egroup.'s'][$evalue]) ? $GLOBALS['em_'.$egroup.'s'][$evalue] : '');}else if (preg_match("#([0-9]{1,})\.([0-9]{1,})#", $evalue, $matchs)){$esonvalue = $matchs[1];$etopvalue = $esonvalue - ($esonvalue % 500);$esecvalue = str_replace(".00",".",$evalue);$GLOBALS['em_'.$egroup.'s'][$etopvalue] = empty($GLOBALS['em_'.$egroup.'s'][$etopvalue])? '': $GLOBALS['em_'.$egroup.'s'][$etopvalue];$GLOBALS['em_'.$egroup.'s'][$esonvalue] = empty($GLOBALS['em_'.$egroup.'s'][$esonvalue])? '': $GLOBALS['em_'.$egroup.'s'][$esonvalue];$GLOBALS['em_'.$egroup.'s'][$esecvalue] = empty($GLOBALS['em_'.$egroup.'s'][$esecvalue])? '': $GLOBALS['em_'.$egroup.'s'][$esecvalue];return $GLOBALS['em_'.$egroup.'s'][$etopvalue].' - '.$GLOBALS['em_'.$egroup.'s'][$esonvalue].' - '.$GLOBALS['em_'.$egroup.'s'][$esecvalue];}else{$elimit = $evalue % 500;$erevalue = $evalue - $elimit;$GLOBALS['em_'.$egroup.'s'][$erevalue] = empty($GLOBALS['em_'.$egroup.'s'][$erevalue])? '': $GLOBALS['em_'.$egroup.'s'][$erevalue];$GLOBALS['em_'.$egroup.'s'][$evalue] = empty($GLOBALS['em_'.$egroup.'s'][$evalue])? '': $GLOBALS['em_'.$egroup.'s'][$evalue];return $GLOBALS['em_'.$egroup.'s'][$erevalue].' - '.$GLOBALS['em_'.$egroup.'s'][$evalue];}}}?>
修改后,再去提交数据试试。发现就会显示文字了!