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

打开/include/taglib/tag.lib.php文件,找到下列代码,(注意备份好原有文件,以免发生错误)
01 $dsql->SetQuery("SELECT * FROM `tagindex` $addsql ORDER BY $orderby LIMIT 0,$num");
02 $dsql->Execute();
03 $ctp new DedeTagParse();
04 $ctp->SetNameSpace('field','[',']');
05 $ctp->LoadSource($InnerText);
06 while($row $dsql->GetArray())
07 $row['keyword'] = $row['tag']; $row['tag'] = dede_htmlspecialchars($row['tag']);
08 $row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/"$row['highlight'] = 0;
09 if($row['monthcc']>1000 || $row['weekcc']>300 )
10 {
11 $row['highlight'] = mt_rand(3,4);
12 }
13 else if($row['count']>3000)
14 {
15 $row['highlight'] = mt_rand(5,6);
16 }
17 else
18 {
19 $row['highlight'] = mt_rand(1,2);
20 }
21 foreach($ctp->CTags as $tagid=>$ctag)
22 if(isset($row[$ctag->GetName()]))
23 {
24 $ctp->Assign($tagid,$row[$ctag->GetName()]);
25 } }
26 $revalue .= $ctp->GetResult();
27 }

将以上代码修改为
01 $dsql->SetQuery("SELECT * FROM `tagindex` $addsql ORDER BY $orderby LIMIT 0,$num");
02 $dsql->Execute();
03 $GLOBALS['autoindex'] = 0;
04 $ctp new DedeTagParse();
05 $ctp->SetNameSpace('field','[',']');
06 $ctp->LoadSource($InnerText);
07 while(
08 $row $dsql->GetArray())
09 {
10 $row['keyword'] = $row['tag']; $row['tag'] = dede_htmlspecialchars($row['tag']);
11 $row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";
12 $row['highlight'] = 0;
13 if($row['monthcc']>1000 || $row['weekcc']>300 )
14 {
15 $row['highlight'] = mt_rand(3,4);
16 }
17 else if($row['count']>3000)
18 $row['highlight'] = mt_rand(5,6); }
19 else $row['highlight'] = mt_rand(1,2); }
20 foreach($ctp->CTags as $tagid=>$ctag)
21 {
22 if(isset($row[$ctag->GetName()]))
23 $ctp->Assign($tagid,$row[$ctag->GetName()]);
24 } }
25 $revalue .= $ctp->GetResult(); $GLOBALS['autoindex']++;
26 }
这样就可以实现了
 
实现后的效果如下:

推荐模板

上一篇:dede织梦模板分页用dede:sql标签实现方法

下一篇:dedecom织梦栏目(动态、静态)分页教程

猜你喜欢

dede织梦模板网