织梦建站的时候文章或者图集自增办法

阅读: 评论:0

织梦建站的时候文章或者图集自增办法

织梦建站的时候文章或者图集自增办法


若有不周之处欢迎指正交流!!

未经允许,不得转载!


在织梦建站的时候难免要获取一些自增的文章或者是图集的序号,用户展示与用户交互效果的实现!


再高版本的CMSdede中 [field:global name=autoindex/]标签是可以正常使用的!

但是没有的话怎么弄呢?这就要稍微改造下了!

找到php文件:下的lib_productimagelist函数,

修改:找到$ctp = new DedeTagParse();

$ctp = new DedeTagParse();$ctp->SetNameSpace('field','[',']');$ctp->LoadSource($innerText);$GLOBALS['autoindex'] = 1; //序号递增$GLOBALS['number'] = count($images);//统计总数foreach($images as $row){foreach($ctp->CTags as $tagid=>$ctag){if(isset($row[$ctag->GetName()])){ $ctp->Assign($tagid,$row[$ctag->GetName()]); }}$revalue .= $ctp->GetResult();$GLOBALS['autoindex']++; //循环添加}return $revalue;

$ctp->LoadSource($Innertext);
下面加上:
$GLOBALS['autoindex'] = 1;


if(!empty($row[$ctag->GetName()])){ $ctp->Assign($tagid,$row[$ctag->GetName()]); }
        }
下面加上:
$GLOBALS['autoindex']++;


$GLOBALS['number'] = count($images);//添加全局变量统计总数

页面调用方法:[field:global name=autoindex/]序号;[field:global name=number/]总数即可。


附:

织梦dedecms autoindex,itemindex 从0到1开始

自增1

arclist            标签下使用 [field:global.autoindex/] 默认从1开始

channel         标签下使用 [field:global.autoindex/] 默认从0开

channelartlist 标签下使用 {dede:global.itemindex/}  默认从1开始

 

arclist  从0开始 [field:global name=autoindex runphp="yes"]@me=@me-1;[/field:global]

channel  从1开始 [field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global][field:typename/]

channelartlist  从0开始 {dede:global name=itemindex runphp='yes'}@me=@me-1;{/dede:global}



感谢阅读!

本文发布于:2024-02-05 01:39:13,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170721092561848.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:建站   图集   办法   文章
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23