1. 程式人生 > >dedecms自定義聯動類別呼叫及修改方法

dedecms自定義聯動類別呼叫及修改方法

  1. require_once(DEDEROOT.'/data/enums/infotype.php');
  2. 下面新增
  3. require_once(DEDEROOT.'/data/enums/自定義聯動類別欄位名.php');
  4. function lib_infolink(&$ctag,&$refObj)
  5. {
  6.     global $dsql,$nativeplace,$infotype,$自定義聯動類別欄位名,$hasSetEnumJs,$cfg_cmspath,$cfg_mainsite;
  7.     global $em_nativeplaces,$em_infotypes,$em_自定義聯動類別欄位名s;  //看清楚,這裡後面的個S
  8. $fields = array('nativeplace'=>'','infotype'=>'','自定義聯動類別欄位名'=>'','typeid'=>$typeid,
  9.                     'channelid'=>$channelid,'linkallplace'=>'','linkealltype'=>'','linkeall自定義聯動類別欄位名'=>'');
  10.     $fields['nativeplace'] = $fields['infotype'] = $fields['自定義聯動類別欄位名'] = '';
  11. $fields['linkalltype'] = "<a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}& amp;nativeplace={$nativeplace}'>不限</a>";
  12. //下面新增一行
  13. $fields['linkeall 自定義聯動類別欄位名'] = "<a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}& amp;自定義聯動類別欄位名={$自定義聯動類別欄位名}&nativeplace={$nativeplace}'>不限< /a>";
  14. 搜尋  if(is_array($ctp->CTags)) 在這句上面新增
  15.     //自定義聯動類別欄位連結
  16.     if(empty($自定義聯動類別欄位名))
  17.     {
  18.         foreach($em_自定義聯動類別欄位名s as $eid=>$em)
  19.         {
  20.             if($eid % 500 != 0) continue;
  21.             $fields[' 自定義聯動類別欄位名'] .= " <a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}& amp;自定義聯動類別欄位名={$eid}&nativeplace={$nativeplace}'>{$em}</a& gt;";
  22.         }
  23.     }
  24.     else
  25.     {
  26.         $sontype = ( ($自定義聯動類別欄位名 % 500 != 0) ? $自定義聯動類別欄位名 : 0 );
  27.       $toptype = ( ($自定義聯動類別欄位名 % 500 == 0) ? $自定義聯動類別欄位名 : ( $自定義聯動類別欄位名-($membertype%500) ) );
  28.         $fields[' 自定義聯動類別欄位名'] = "<a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}& amp;自定義聯動類別欄位名={$toptype}&nativeplace={$nativeplace}'><b& gt;{$em_自定義聯動類別欄位名s[$toptype]}</b></a> ";
  29.         foreach($em_自定義聯動類別欄位名s as $eid=>$em)
  30.         {
  31.             if($eid < $toptype+1 || $eid > $toptype+499) continue;
  32.             if($eid == $自定義聯動類別欄位名) {
  33.                 $fields['自定義聯動類別欄位名'] .= " <b>{$em}</b>";
  34.             }
  35.             else {
  36.                 $fields[' 自定義聯動類別欄位名'] .= " <a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}& amp;自定義聯動類別欄位名={$eid}&nativeplace={$nativeplace}'>{$em}</a& gt;";
  37.           }
  38.       }
  39.     }
  40. 再修改 plus\list.php 檔案
  41. 搜尋  $infotype = ( (empty($infotype) || !is_numeric($infotype)) ? 0 : $infotype );  在下面新增一句
  42.     $自定義聯動類別欄位名 = ( (empty($自定義聯動類別欄位名) || !is_numeric($自定義聯動類別欄位名)) ? 0 : $自定義聯動類別欄位名 );
  43. 再搜尋      if(!empty($infotype)) $cArr['infotype'] = $infotype;
  44. 在下面新增
  45.     if(!empty($自定義聯動類別欄位名)) $cArr['自定義聯動類別欄位名'] = $自定義聯動類別欄位名;
  46. 找到 include\arc.sglistview.class.php 檔案
  47. 搜尋  if(!empty($this->searchArr['keyword']))      在上面新增
  48.     //自定義聯動類別        
  49.             if(!empty($this->searchArr['自定義聯動類別欄位名']))
  50.             {
  51.                 if($this->searchArr['自定義聯動類別欄位名'] % 500 ==0 )
  52.                 {
  53.                     $naddQuery .= " And arc.自定義聯動類別欄位名 >= '{$this->searchArr['自定義聯動類別欄位名']}' And arc.自定義聯動類別欄位名 < '".($this->searchArr['自定義聯動類別欄位名']+500)."'";
  54.                 }
  55.                 else
  56.                 {
  57.                     $naddQuery .= "And arc.自定義聯動類別欄位名 = '{$this->searchArr['自定義聯動類別欄位名']}'";
  58.                 }
  59.             }