ppypp伦理天堂,91手机在线视频,免费在线观看黄色毛片,夜夜穞天天穞狠狠穞AV美女按摩

聯系官方銷售客服

1835022288

028-61286886

投訴 已解決 diy\poscms\field\Related.php關聯 9 0
POSCMS版本:3.5.4 懸賞:5元 #php

diy\poscms\field\Related.php

關聯內容時候只顯示標題,希望改成同時顯示縮略圖。


image.png

發布和編輯時候顯示效果如下(紅色標記為圖):


image.png

解決方案
  • <img src="{dr_get_file($t.thumb)}">

  • 代碼不要截圖

    • 回復@悲劇的石頭

      <?php

      /**

      * POSCMS框架文件

      * 二次開發時請勿修改本文件

      * 成都天睿信息技術有限公司 www.phpkaiyuancms.com

      */

      class F_Related extends A_Field {

      /**

      * 構造函數

      */

      public function __construct() {

      parent::__construct();

      $this->name = fc_lang('內容關聯'); // 字段名稱

      $this->fieldtype = array('TEXT' => ''); // TRUE表全部可用字段類型,自定義格式為 array('可用字段類型名稱' => '默認長度', ... )

      $this->defaulttype = 'TEXT'; // 當用戶沒有選擇字段類型時的缺省值

      }

      /**

      * 字段相關屬性參數

      *

      * @param array $value

      * @return string

      */

      public function option($option) {

      $_option = '';

      $_module = $this->ci->get_cache('module', SITE_ID);

      if ($_module) {

      foreach ($_module as $dir) {

      $_option.= '<option value="'.$dir.'" '.($dir == $option['module'] ? 'selected' : '').'>'.$dir.'</option>';

      }

      }

      $option['width'] = isset($option['width']) ? $option['width'] : '90%';

      return '<div class="form-group">

      <label class="col-md-2 control-label">'.fc_lang('模塊').':</label>

      <div class="col-md-9">

      <label><select class="form-control" name="data[setting][option][module]">

      '.$_option.'

      </select></label>

      <span class="help-block">'.fc_lang('必須選擇一個模塊作為關聯數據源').'</span>

      </div>

      </div>

      <div class="form-group">

      <label class="col-md-2 control-label">'.fc_lang('寬度').':</label>

      <div class="col-md-9">

      <label><input type="text" class="form-control" size="10" name="data[setting][option][width]" value="'.$option['width'].'"></label>

      <span class="help-block">'.fc_lang('[整數]表示固定寬帶;[整數%]表示百分比').'</span>

      </div>

      </div>

      <div class="form-group">

      <label class="col-md-2 control-label">'.fc_lang('最大顯示數量').':</label>

      <div class="col-md-9">

      <label><input type="text" class="form-control" size="10" name="data[setting][option][limit]" value="'.$option['limit'].'"></label>

      <span class="help-block">'.fc_lang('關聯列表搜索結果最大顯示數量,默認50條').'</span>

      </div>

      </div>

      <div class="form-group">

      <label class="col-md-2 control-label">'.fc_lang('友情提示').':</label>

      <div class="col-md-9">

      <div class="form-control-static">'.fc_lang('此字段不能參與搜索條件篩選').'</div>

      </div>

      </div>';

      }

      /**

      * 字段輸出

      */

      public function output($value) {

      return $value;

      }

      /**

      * 字段入庫值

      */

      public function insert_value($field) {

      $data = $this->ci->post[$field['fieldname']];

      $value = !$data ? '' : implode(',', $data);

      $this->ci->data[$field['ismain']][$field['fieldname']] = $value;

      }

      /**

      * 字段表單輸入

      *

      * @param string $cname 字段別名

      * @param string $name 字段名稱

      * @param array $cfg 字段配置

      * @param string $value

      * @return string

      */

      public function input($cname, $name, $cfg, $value = NULL, $id = 0) {

      // 字段顯示名稱

      $text = (isset($cfg['validate']['required']) && $cfg['validate']['required'] == 1 ? '<font color="red">*</font>' : '').''.$cname.':';

      // 表單寬度設置

      $width = isset($cfg['option']['width']) && $cfg['option']['width'] ? $cfg['option']['width'] : '80%';

      // 表單附加參數

      $attr = isset($cfg['validate']['formattr']) && $cfg['validate']['formattr'] ? $cfg['validate']['formattr'] : '';

      // 字段提示信息

      $tips = isset($cfg['validate']['tips']) && $cfg['validate']['tips'] ? '<span class="help-block" id="dr_'.$name.'_tips">'.$cfg['validate']['tips'].'</span>' : '';

      // 禁止修改

      $disabled = !IS_ADMIN && $id && $value && isset($cfg['validate']['isedit']) && $cfg['validate']['isedit'] ? 'disabled' : '';

      // 模塊名稱

      $module = isset($cfg['option']['module']) ? $cfg['option']['module'] : '';

      //

      $tpl = '<li id="files_'.$name.'_{id}" style="padding-right:10px;cursor:move;border-bottom: 1px solid #EEEEEE;"><a href="javascript:;" onclick="dr_remove_file(\''.$name.'\',\'{id}\')"><img align="absmiddle" src="'.THEME_PATH.'admin/images/b_drop.png"></a>&nbsp;{value}<input type="hidden" name="data['.$name.'][]" value="{id}"></li>';

      //

      $str = '<fieldset class="blue pad-10" style="width:'.$width.(is_numeric($width) ? 'px' : '').';">';

      $str.= '<legend>'.$cname.'</legend>';

      $str.= '<div class="picList">';

      $str.= '<ul class="'.$name.'-sort-items" id="dr_list_'.$name.'" style="max-height: 400px;overflow-y: auto;">';

      $value = @trim($value, ',');

      if ($value && is_string($value)) {

      $query = $this->ci->db->query('select id,title,url,thumb from '.$this->ci->db->dbprefix(SITE_ID.'_'.$module).' where id IN ('.$value.') order by instr("'.$value.'", id)')->result_array();

      foreach ($query as $t) {

      $id = $t['id'];

      $value = '<a href="'.$t['url'].'" target="_blank">'.$t['thumb'].'</a>';

      $str.= str_replace(array('{id}', '{value}'), array($id, $value), $tpl);

      }

      }

      $str.= '</ul>';

      $str.= '</div>';

      $str.= '<div class="bk10"></div>';

      if(!defined('FINECMS_LINKAGE_INIT_LD')) {

      define('FINECMS_LINKAGE_INIT_LD', 1);

      $str.= '<script type="text/javascript" src="'.THEME_PATH.'js/jquery.ld.js"></script>';

      }

      $str.= '

      <script type="text/javascript">

      function dr_add_related_'.$name.'() {

      art.dialog.open("/index.php?s=member&c=api&m=related&site='.SITE_ID.'&module='.$module.'&limit='.intval($cfg['option']['limit']).'", {

      title: "'.$cname.'",

      opacity: 0.1,

      width: 700,

      height: 400,

      ok: function () {

      var iframe = this.iframe.contentWindow;

      if (!iframe.document.body) {

      alert("iframe loading")

      return false;

      };

      var id;

      var value;

      var err = 0;

      var select = iframe.document.getElementsByName("ids[]");

      for (var i=0; i < select.length; i++) {

      if (select[i].checked) {

      id = select[i].value;

      value = iframe.document.getElementById("dr_row_"+id).innerHTML;

      if ($("#files_'.$name.'_"+id).size() == 0) {

      var html = \''.addslashes(str_replace(array("\r", "\n", "\t", chr(13)), '', $tpl)).'\';

      html = html.replace(/{id}/g, id);

      html = html.replace(/{value}/g, value);

      $("#dr_list_'.$name.'").append(html);

      } else {

      err ++;

      }

      }

      }

      if (err > 0) {

      dr_tips("有"+err+"條記錄已經存在了");

      }

      },

      cancel: true

      });

      }

      $(".'.$name.'-sort-items").sortable();

      </script>

      </fieldset>';

      $str.= '<div class="bk10"></div>';

      $str.= '<button type="button" class="btn blue btn-sm" onClick="dr_add_related_'.$name.'()"> <i class="fa fa-plus"></i> 添加</button>';

      $str.= $tips;

      return $this->input_format($name, $text, $str);

      }

      }

      文件路徑:

      diy\poscms\field\Related.php

      BES
  • $value = '<a target="_blank" href="'.$t['url'].'" target="_blank">'.$t['thumb'].'</a>';

    $str.= str_replace(array('{id}', '{value}'), array($id, $value), $tpl);


    改成

    $value = '<a target="_blank" href="'.$t['url'].'" target="_blank">'.$t['title'].'<img src="'.dr_get_file($t['thumb']).'"></a>';

    $str.= str_replace(array('{id}', '{value}'), array($id, $value), $tpl);


  • 你不是單文件嗎?

  • $img = dr_string2array($t['thumb']); // 圖片專用字段

    $value = '<a target="_blank" target="_blank" href="'.$t['url'].'" target="_blank">'.$t['title'].'<img src="'.dr_get_file($img[0]).'"></a>';

    $str.= str_replace(array('{id}', '{value}'), array($id, $value), $tpl);

    滿意答案
    短信幣+1
    +5元
  • @農村人:跪謝大神~謝謝啦~
    BES