1. 程式人生 > >織夢dedecms多選checkbox欄位值獨立輸出樣式呼叫方法

織夢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}