- 主页 > 织梦学院 > 织梦安装 > 织梦dede:tag标签增加[field:global.autoindex/]递增标签
织梦dede:tag标签增加[field:global.autoindex/]递增标签
发布:2018-12-06
浏览:
TAG标签:
织梦递增标签
打开/include/taglib/tag.lib.php文件,找到下列代码,(注意备份好原有文件,以免发生错误)
01 |
$dsql ->SetQuery( "SELECT * FROM `tagindex` $addsql ORDER BY $orderby LIMIT 0,$num" ); |
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 ) |
11 |
$row [ 'highlight' ] = mt_rand(3,4); |
13 |
else if ( $row [ 'count' ]>3000) |
15 |
$row [ 'highlight' ] = mt_rand(5,6); |
19 |
$row [ 'highlight' ] = mt_rand(1,2); |
21 |
foreach ( $ctp ->CTags as $tagid => $ctag ) |
22 |
{ if (isset( $row [ $ctag ->GetName()])) |
24 |
$ctp ->Assign( $tagid , $row [ $ctag ->GetName()]); |
26 |
$revalue .= $ctp ->GetResult(); |
|
将以上代码修改为
01 |
$dsql ->SetQuery( "SELECT * FROM `tagindex` $addsql ORDER BY $orderby LIMIT 0,$num" ); |
03 |
$GLOBALS [ 'autoindex' ] = 0; |
04 |
$ctp = new DedeTagParse(); |
05 |
$ctp ->SetNameSpace( 'field' , '[' , ']' ); |
06 |
$ctp ->LoadSource( $InnerText ); |
08 |
$row = $dsql ->GetArray()) |
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 ) |
15 |
$row [ 'highlight' ] = mt_rand(3,4); |
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 ) |
22 |
if (isset( $row [ $ctag ->GetName()])) |
23 |
{ $ctp ->Assign( $tagid , $row [ $ctag ->GetName()]); |
25 |
$revalue .= $ctp ->GetResult(); $GLOBALS [ 'autoindex' ]++; |
|
这样就可以实现了
实现后的效果如下:
猜你喜欢