HTML/JS转换工具
Unicode编码转换
当前位置:首页 > 软件教程 > dedecms > 

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

来源:IT技术网编辑:雨天发布于:2018-01-15人围观

织梦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/]标签
织梦二维码生成器

与相关的文章
有时间的话来看看IT界的突发事件
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片