博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
织梦dedecms多选checkbox字段值独立输出样式调用方法
阅读量:6308 次
发布时间:2019-06-22

本文共 2389 字,大约阅读时间需要 7 分钟。

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

你可能感兴趣的文章
用decimal模块增加python的浮点数精度
查看>>
TOJ 2419: Ferry Loading II
查看>>
填坑:U盘安装RedHat5后,拔掉U盘无法引导
查看>>
linux常用命令练习
查看>>
实验报告二201521460014
查看>>
nodejs读取excel内容批量替换并生成新的html和新excel对照文件
查看>>
day11 reduce函数
查看>>
Scrapy 框架 - 简介
查看>>
在SuperSocket中启用TLS/SSL传输层加密
查看>>
py 的 第 37 天
查看>>
文本的四种编码方式
查看>>
img 是内联元素
查看>>
ecshop调用指定栏目下的文章的方法
查看>>
C 入门 第六节 自定义函数
查看>>
leetcode--Balanced Binary Tree
查看>>
locate
查看>>
取消输入框的轮廓线,禁止拖拽
查看>>
关于new enhancement的一些知识
查看>>
Yii2 增删查改
查看>>
预言帖,WP7迟早有一天会失败
查看>>