Dedecms自訂聯動類別調用實現程式

來源:互聯網
上載者:User

建模型的時候一定是獨立模型

先修改 includetaglibinfolink.lib.php 檔案

 代碼如下 複製代碼
require_once(DEDEROOT.'/data/enums/infotype.php');

下面添加

 代碼如下 複製代碼

require_once(DEDEROOT.'/data/enums/自訂聯動類別欄位名.php');


function lib_infolink(&$ctag,&$refObj)
{
    global $dsql,$nativeplace,$infotype,$自訂聯動類別欄位名,$hasSetEnumJs,$cfg_cmspath,$cfg_mainsite;
    global $em_nativeplaces,$em_infotypes,$em_自訂聯動類別欄位名s;  //看清楚,這裡後面的個S


$fields = array('nativeplace'=>'','infotype'=>'','自訂聯動類別欄位名'=>'','typeid'=>$typeid,
                    'channelid'=>$channelid,'linkallplace'=>'','linkealltype'=>'','linkeall自訂聯動類別欄位名'=>'');
    
    $fields['nativeplace'] = $fields['infotype'] = $fields['自訂聯動類別欄位名'] = '';

 


$fields['linkalltype'] = "<a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&nativeplace={$nativeplace}'>不限</a>";


//下面添加一行

 代碼如下 複製代碼

$fields['linkeall自訂聯動類別欄位名'] = "<a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&自訂聯動類別欄位名={$自訂聯動類別欄位名}&nativeplace={$nativeplace}'>不限</a>";


搜尋  if(is_array($ctp->CTags)) 在這句上面添加

 代碼如下 複製代碼

  
    //自訂聯動類別欄位連結
    if(empty($自訂聯動類別欄位名))
    {
        foreach($em_自訂聯動類別欄位名s as $eid=>$em)
        {
            if($eid % 500 != 0) continue;
            $fields['自訂聯動類別欄位名'] .= " <a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&自訂聯動類別欄位名={$eid}&nativeplace={$nativeplace}'>{$em}</a>";
        }
    }
    else
    {
        $sontype = ( ($自訂聯動類別欄位名 % 500 != 0) ? $自訂聯動類別欄位名 : 0 );
      $toptype = ( ($自訂聯動類別欄位名 % 500 == 0) ? $自訂聯動類別欄位名 : ( $自訂聯動類別欄位名-($membertype%500) ) );
        $fields['自訂聯動類別欄位名'] = "<a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&自訂聯動類別欄位名={$toptype}&nativeplace={$nativeplace}'><b>{$em_自訂聯動類別欄位名s[$toptype]}</b></a> ";
        foreach($em_自訂聯動類別欄位名s as $eid=>$em)
        {
            if($eid < $toptype+1 || $eid > $toptype+499) continue;
            if($eid == $自訂聯動類別欄位名) {
                $fields['自訂聯動類別欄位名'] .= " <b>{$em}</b>";
            }
            else {
                $fields['自訂聯動類別欄位名'] .= " <a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&自訂聯動類別欄位名={$eid}&nativeplace={$nativeplace}'>{$em}</a>";
          }
      }
    }

再修改 pluslist.php 檔案

搜尋 

 代碼如下 複製代碼
$infotype = ( (empty($infotype) || !is_numeric($infotype)) ? 0 : $infotype ); 

在下面添加一句


$自訂聯動類別欄位名 = ( (empty($自訂聯動類別欄位名) || !is_numeric($自訂聯動類別欄位名)) ? 0 : $自訂聯動類別欄位名 );
    
再搜尋   

 代碼如下 複製代碼
   if(!empty($infotype)) $cArr['infotype'] = $infotype;

在下面添加
    if(!empty($自訂聯動類別欄位名)) $cArr['自訂聯動類別欄位名'] = $自訂聯動類別欄位名;

 
    

找到 includearc.sglistview.class.php 檔案

搜尋  if(!empty($this->searchArr['keyword']))     

在上面添加

 代碼如下 複製代碼
 //自訂聯動類別        
 if(!empty($this->searchArr['自訂聯動類別欄位名']))
            {
                if($this->searchArr['自訂聯動類別欄位名'] % 500 ==0 )
                {
                    $naddQuery .= " And arc.自訂聯動類別欄位名 >= '{$this->searchArr['自訂聯動類別欄位名']}' And arc.自訂聯動類別欄位名 < '".($this->searchArr['自訂聯動類別欄位名']+500)."'";
                }
                else
                {
                    $naddQuery .= "Ad arc.自訂聯動類別欄位名 = '{$this->searchArr['自訂聯動類別欄位名']}'";
                }
            }


            
模板調用  

 代碼如下 複製代碼


  [field:linkeall自訂聯動類別欄位名/] [field:自訂聯動類別欄位名 /]

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.