destoon中自定义字段的前台显示,及修改相关属性
来源:互联网 发布:使用阿里云建设ss隧道 编辑:程序博客网 时间:2024/06/06 12:47
在destoon中模块的自定义字段存储在destonn_fields这个表中
自定义字段的前台显示使用的是fields_html这个函数在fields.func.php文件中,这个函数的定义如下,
function fields_html($left = '<td class="tl">', $right = '<td>', $values = array(), $fd = array()) {extract($GLOBALS, EXTR_SKIP);if($fd) $FD = $fd;$html = '';foreach($FD as $k=>$v) {if(!$v['display']) continue;if(!defined('DT_ADMIN') && !$v['front']) continue;$html .= fields_show($k, $left, $right, $values, $fd);}return $html;}
这个函数不是使用$left与right这两个变量中包含的html包住我们自定义的字段,这样就显示非常的不和谐,很不好自定义界面,
这个函数中使用的了一个$FD的变量,这个变量是一个全局变量,在用户中心显示编辑界面时,变量的初始公是在my.inc.php中
if (in_array($action, array('add', 'edit'))){ $FD = cache_read('fields-' . substr($table, strlen($DT_PRE)) . '.php'); if ($FD) require DT_ROOT . '/include/fields.func.php'; isset($post_fields) or $post_fields = array(); $CP = $MOD['cat_property']; if ($CP) require DT_ROOT . '/include/property.func.php'; isset($post_ppt) or $post_ppt = array();}
<?php defined('IN_DESTOON') or exit('Access Denied');return array( 19 => array('itemid' => '19', 'tb' => 'dingzhi_40', 'name' => 'qidian', 'title' => '起点', 'note' => '', 'type' => 'int', 'length' => '10', 'html' => 'area', 'default_value' => '', 'option_value' => '', 'width' => '120', 'height' => '90', 'input_limit' => '', 'addition' => '', 'display' => '1', 'front' => '1', 'listorder' => '0',), 20 => array('itemid' => '20', 'tb' => 'dingzhi_40', 'name' => 'zhongdian', 'title' => '终点', 'note' => '', 'type' => 'int', 'length' => '10', 'html' => 'area', 'default_value' => '', 'option_value' => '', 'width' => '120', 'height' => '90', 'input_limit' => '', 'addition' => '', 'display' => '1', 'front' => '1', 'listorder' => '0',), 21 => array('itemid' => '21', 'tb' => 'dingzhi_40', 'name' => 'shuojihao', 'title' => '手机号', 'note' => '', 'type' => 'varchar', 'length' => '15', 'html' => 'text', 'default_value' => '', 'option_value' => '', 'width' => '120', 'height' => '90', 'input_limit' => '', 'addition' => 'size="30"', 'display' => '1', 'front' => '1', 'listorder' => '0',), 22 => array('itemid' => '22', 'tb' => 'dingzhi_40', 'name' => 'shixiao', 'title' => '时效', 'note' => '', 'type' => 'varchar', 'length' => '255', 'html' => 'radio', 'default_value' => '', 'option_value' => '1|1天内*2|2天内*3|3天内*4|4天内*5|5天内*6|6天内*7|7天内*', 'width' => '120', 'height' => '90', 'input_limit' => '', 'addition' => '', 'display' => '1', 'front' => '1', 'listorder' => '0',),);?>
个人觉得如果要修改某个字段的相关特性时,只需要传入特定属性就可以了,因此我对函数做了一点改变,因为我只需要改变title就可以,所以没有对这个函数做太大的改动
{php $mycust=array("qidian"=>"发车起点:");}
{if $FD}{fields_html3('<li><p>--name--:</p><span>--control--</span></li>',$item, $mycust)}{/if}
function fields_html3($template, $values = array(), $mycust = array()) { extract($GLOBALS, EXTR_SKIP); // if($fd) $FD = $fd;这里的本意是用我们自定义的字段来替换从缓存中读取的字段,但是这样的就有点麻烦, // print_r($FD); $html = ''; foreach ($FD as $k => &$v) { if (!$v['display']) continue; if (!defined('DT_ADMIN') && !$v['front']) continue; $v["temphtml"] = fields_show2($k, $values ); $title = $v["title"]; if(isset($mycust[$v["name"]])) $title = $mycust[$v['name']]; $temp = str_replace("--name--", $title,$template); $temp = str_replace("--control--", $v["temphtml"],$temp); $html.=$temp."\r\n"; } return $html;}
1 0
- destoon中自定义字段的前台显示,及修改相关属性
- sql中修改字段属性的写法
- mysql修改字段的类型和相关属性
- 背景,尺寸及显示的相关属性
- echarts2.0修改markpoint及markline的属性(markpoint显示隐藏,并且实现自定义图例)
- 后台管理前台要显示的字段
- mysql 修改字段的属性
- 修改oracle数据库字段及属性
- 数据库自定义字段及相关检索
- 自定义控件的构造方法及相关属性的理解
- Salesforce Lightning 中修改"最近列表"要显示的字段
- arcgis engine中添加及修改图层的字段
- css中cursor自定义光标的相关属性
- js中设置、取、修改、删除,自定义属性的值
- destoon 修改图片上传的存储路径
- destoon的企业的新闻中心不显示
- destoon分页的不能显示的原因
- 如何自定义destoon的地址生成规则
- 最少拦截系统
- C++关系运算和逻辑运算
- 面向对象和Hibernate简要理解
- ButterKnife
- Android anim使用
- destoon中自定义字段的前台显示,及修改相关属性
- GPU的发展历程
- Android 自定义ViewGroup
- Spring建立XML时候需要注意的问题
- 如何在mtk kernel中新添加一个摄像头驱动
- POJ-1691-Painting A Board
- php 构造函数与析构函数
- 基于window10平台的ftp搭建
- 【oracle】关于重装oracle等问题点