织梦dedecms多选checkbox字段值独立输出样式调用方法

在做织梦网站时发现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}

 

转载于:https://www.cnblogs.com/zhoupengyi/p/10248172.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值