联系官方销售客服
1835022288
028-61286886
解决关联字段只显示ID问题,添加自定义函数后可以显示标题,代码提取自官方,简单做了下修改
文件地址:/config/custom.php
function eos_title($value, $param = [], $data = []) { if (!$value) { return ''; } $mid = defined('MOD_DIR') ? MOD_DIR : ''; $value = htmlspecialchars(dr_clearhtml($value)); $title = ($data['thumb'] ? '<i class="fa fa-photo"></i> ' : '') . dr_keyword_highlight($value, $param['keyword']); !$title && $title = '...'; return isset($data['url']) && $data['url'] ? ('<a href="' . dr_url_prefix($data['url'], $mid) . '" target="_blank" class="tooltips" data-container="body" data-placement="top" data-original-title="' . $value . '" title="' . $value . '">' . $title . '</a>' . ($data['link_id'] > 0 ? ' <i class="fa fa-link font-green" title="' . dr_lang('同步链接') . '"></i>' : '')) : $title; } // 关联标题 function eos_related_title($cid, $param = [], $data = [], $field = []) { if (!$cid) { return dr_lang('未关联'); } $mid = $field['setting']['option']['module']; \Phpcmf\Service::C()->cid_data[$cid] = isset(\Phpcmf\Service::C()->cid_data[$cid]) && \Phpcmf\Service::C()->cid_data[$cid] ? \Phpcmf\Service::C()->cid_data[$cid] : \Phpcmf\Service::M()->table_site($mid)->get($cid); return \Phpcmf\Service::C()->cid_data[$cid] ? eos_title(\Phpcmf\Service::C()->cid_data[$cid]['title'], $param, \Phpcmf\Service::C()->cid_data[$cid]) : dr_lang('关联主题不存在'); }