建模型的時候一定是獨立模型
先修改 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:自訂聯動類別欄位名 /]
|