在做织梦网站时发现dedecms的自建字段的checkboxcook输出是一段证不能把每个标签分开写样式,在晚上查了好多没页没有好的,最终用中方式来做会好
{dede:field.fyuantese runphp=yes}
$arr = explode(',',@me); $result = ''; for($index=0;$index<count($arr);$index++){ switch ($arr[$index]){ case "衣柜": $result .= " <li><i style='background: url(/images/bgpic.png) no-repeat ;width:35px;height:35px;display: inline-block;'></i><p class='tese'>$arr[$index]</p></li>"; break; case "桌椅": $result .= "<li><i style='background: url(/images/bgpic.png) no-repeat ;width:35px;height:35px;display: inline-block;background-position: -385px 0'></i><p class='tese'>$arr[$index]</p></li>"; break; case "电视": $result .= "<li><i style='background: url(/images/bgpic.png) no-repeat ;width:35px;height:35px;display: inline-block;background-position: -70px 0'></i><p class='tese'>$arr[$index]</p></li>"; break; case "冰箱": $result .= "<li><i style='background: url(/images/bgpic.png) no-repeat ;width:35px;height:35px;display: inline-block;background-position: -105px 0'></i><p class='tese'>$arr[$index]</p></li>"; break; case "洗衣机": $result .= "<li><i style='background: url(/images/bgpic.png) no-repeat ;width:35px;height:35px;display: inline-block;background-position: -140px 0'></i><p class='tese'>$arr[$index]</p></li>"; break; case "空调": $result .= "<li><i style='background: url(/images/bgpic.png) no-repeat ;width:35px;height:35px;display: inline-block;background-position: -175px 0'></i><p class='tese'>$arr[$index]</p></li>"; break; case "热水器": $result .= "<li><i style='background: url(/images/bgpic.png) no-repeat ;width:35px;height:35px;display: inline-block;background-position: -210px 0'></i><p class='tese'>$arr[$index]</p></li>"; break; case "独立卫生间": $result .= "<li><i style='background: url(/images/bgpic.png) no-repeat ;width:35px;height:35px;display: inline-block;background-position: -350px 0'></i><p class='tese'>$arr[$index]</p></li>"; break; case "暖气": $result .= "<li><i style='background: url(/images/bgpic.png) no-repeat ;width:35px;height:35px;display: inline-block;background-position: -245px 0'></i><p class='tese'>$arr[$index]</p></li>"; break; case "天然气": $result .= "<li><i style='background: url(/images/bgpic.png) no-repeat ;width:35px;height:35px;display: inline-block;background-position: -315px 0'></i><p class='tese'>$arr[$index]</p></li>"; break; } } @me=$result; {/dede:field.fyuantese}