织梦cms为dede:tag标签增加[field:global.autoindex/]标签

有人这样描绘四姑娘山:四姑娘山孕育着银色冬天的梦幻,绿色春天的生命,金色秋天的希望,蓝色夏天的憧憬。四姑娘山,走进她,靠近她,你才知道什么是美,这种美带给你的是各种不同的感受,四季轮转中也无改她的美丽,四姑娘山如婉约的少女,又如豪壮的勇士,伫立在天地间,无比的圣洁,不愧是蜀山之后,东方的阿尔卑斯。
织梦cms为{dede:tag}增加[field:global.autoindex/]标签的方法,首先打开/include/taglib/tag.lib.php文件,找到下列代码,(注意备份好原有文件,以免发生错误)
 
$dsql->SetQuery("SELECT * FROM `tagindex` $addsql ORDER BY $orderby LIMIT 0,$num"); 
$dsql->Execute(); 
$ctp = new DedeTagParse(); 
$ctp->SetNameSpace('field','[',']'); 
$ctp->LoadSource($InnerText); 
while($row = $dsql->GetArray()) 
{ $row['keyword'] = $row['tag']; $row['tag'] = dede_htmlspecialchars($row['tag']); 
$row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/"; $row['highlight'] = 0; 
if($row['monthcc']>1000 || $row['weekcc']>300 ) 
{ 
$row['highlight'] = mt_rand(3,4); 
} 
else if($row['count']>3000) 
{ 
$row['highlight'] = mt_rand(5,6); 
} 
else 
{ 
$row['highlight'] = mt_rand(1,2); 
} 
foreach($ctp->CTags as $tagid=>$ctag) 
{ if(isset($row[$ctag->GetName()])) 
{ 
$ctp->Assign($tagid,$row[$ctag->GetName()]); 
} } 
$revalue .= $ctp->GetResult(); 
}
 
将以上代码修改为
 
$dsql->SetQuery("SELECT * FROM `tagindex` $addsql ORDER BY $orderby LIMIT 0,$num"); 
$dsql->Execute(); 
$GLOBALS['autoindex'] = 0; 
$ctp = new DedeTagParse(); 
$ctp->SetNameSpace('field','[',']'); 
$ctp->LoadSource($InnerText); 
while(
$row = $dsql->GetArray()) 
{ 
$row['keyword'] = $row['tag']; $row['tag'] = dede_htmlspecialchars($row['tag']); 
$row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/"; 
$row['highlight'] = 0; 
if($row['monthcc']>1000 || $row['weekcc']>300 ) 
{ 
$row['highlight'] = mt_rand(3,4); 
} 
else if($row['count']>3000) 
{ $row['highlight'] = mt_rand(5,6); } 
else { $row['highlight'] = mt_rand(1,2); } 
foreach($ctp->CTags as $tagid=>$ctag) 
{ 
if(isset($row[$ctag->GetName()])) 
{ $ctp->Assign($tagid,$row[$ctag->GetName()]); 
} } 
$revalue .= $ctp->GetResult(); $GLOBALS['autoindex']++; 
}
这样就可以实现了
 
实现后的效果如下:

以上就是织梦cms为dede:tag标签增加[field:global.autoindex/]标签。有多少所谓的闪光,就有多少那些灰暗的时刻,任何时候都应该看清自己,别觉得自己那么渺小,也别觉得自己那么伟大。更多关于织梦cms为dede:tag标签增加[field:global.autoindex/]标签请关注haodaima.com其它相关文章!

标签: dede cms