当前位置:网站首页>Pbcms adding cyclic digital labels
Pbcms adding cyclic digital labels
2022-06-25 01:24:00 【Busy PK ends】
background : When I see someone in the group asking me to page the list page , The number opened in the new page is still from 1 Start calculating . At that time, I thought it was very simple , Use it directly php You can assign values to the loop statements of , Then I thought something was wrong , The template file is html Suffix is not .php Format files cannot be used directly php sentence . So I think of the custom labels I made before . Here is a custom tag added .( The purpose is to change the following figure from 11-20 Turn into 1-10)

Front label
<a href="[list:link]">[list:num][list:title]</a>among [list:num] It's our new tag
Modified backend :
\apps\home\controller\ParserController.php Class that parses the tag
modify public function parserListLabel($content, $cscode = '') This method
Find this sentence in this method :
foreach ($data as $value) { // Cycle by the number of query data
$one_html = $matches[2][$i];
for ($j = 0; $j < $count2; $j ++) { // Cyclic replacement data
$params = $this->parserParam($matches2[2][$j]);
$one_html = $this->parserList($matches2[1][$j], $matches2[0][$j], $one_html, $value, $params, $key);
}
$key ++;
$out_html .= $one_html;Then modify the following two sentences :
foreach ($data as $value) { // Cycle by the number of query data
$one_html = $this->parserList($matches2[1][$j], $matches2[0][$j], $one_html, $value, $params, $key);
It is amended as follows
foreach ($data as $jb=>$value) { // Cycle by the number of query data
$one_html = $this->parserList($matches2[1][$j], $matches2[0][$j], $one_html, $value, $params, $key,$jb+1);
The goal is actually to get the angle of the current cycle
And then modify parserList This method , New pair list:num Parsing
case 'num':
$content = str_replace($search, $num, $content);
break;At the end default: Add the above parsing before . So you can use this normally [list:num] The label
边栏推荐
- js数组对象转对象
- 新一代可级联的以太网远程I/O数据采集模块
- 2种常见的设备稼动率OEE监测方法
- PHP 利用getid3 获取mp3、mp4、wav等媒体文件时长等数据
- AUTOCAD——两种延伸方式
- Welcome to the new world of Lenovo smart screen
- Use redis' sorted set to make weekly hot Reviews
- AssertionError: CUDA unavailable, invalid device 0 requested
- The optimism about technology is making Dell achieve more than expected
- Bi-sql delete
猜你喜欢

Abnova丨CSV 磁珠中英文说明

Bi-sql Union

Programmer: did you spend all your savings to buy a house in Shenzhen? Or return to Changsha to live a "surplus" life?

Introduction to bi-sql wildcards

JVM directive

js数组对象转对象

Bi-sql create

Tianshu night reading notes -- memory paging mechanism

粉丝福利,JVM 手册(包含 PDF)

PMP考试“临门一脚”如何踢得漂亮?
随机推荐
4年工作经验,多线程间的5种通信方式都说不出来,你敢信?
1. 封装自己的脚手架 2.创建代码模块
Cloud development technology summit · public welfare programming challenge [hot registration]!
Program.launch(xxx)打开文件
Super detailed description and derivation of convolution and deconvolution (deconvolution is also called transpose convolution and fractional step convolution)
Hands on data analysis data modeling and model evaluation
Boutique enterprise class powerbi application pipeline deployment
汇编语言(2)基础知识-debug
Use redis' sorted set to make weekly hot Reviews
Bi-sql Union
Reverse ordinal number by merge sort
JVM指令
Properties of DOM
动手学数据分析 数据建模和模型评估
CCNP的BGP部分笔记
PMP考试“临门一脚”如何踢得漂亮?
实验5 8254定时/计数器应用实验【微机原理】【实验】
粉丝福利,JVM 手册(包含 PDF)
PHP 利用getid3 获取mp3、mp4、wav等媒体文件时长等数据
腾讯云WeCity丨产业联合 协同创新 共贺新春!