当前位置:网站首页>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
边栏推荐
- SQL aggregate function handling null [easy to understand]
- mysql查询时间戳转换成日期格式
- The latest QQ wechat domain name anti red PHP program source code + forced jump to open
- Cloud development technology summit · public welfare programming challenge [hot registration]!
- PHP easywechat and applet realize long-term subscription message push
- 在两个有序数组中找到整体第K小的数可以做到O(log(Min(M,N)))
- C语言边界计算和不对称边界
- AutoCAD - two extension modes
- 腾讯云WeCity丨你好 2022!
- Introduction to bi-sql wildcards
猜你喜欢

Install mysql5.6 under linux64bit - the root password cannot be modified

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

1. package your own scaffold 2 Create code module

15.线程同步的几种方法

Bi SQL drop & alter

Bi-sql between

Fan benefits, JVM manual (including PDF)

The innovation consortium of Haihe laboratory established gbase and became one of the first member units of the innovation Consortium (Xinchuang)

汇编语言(2)基础知识-debug

汇编语言(3)16位汇编基础框架与加减循环
随机推荐
音频PCM数据计算声音分贝值,实现简单VAD功能
Redis persistence
对技术的乐观,正让戴尔取得比想象中更多的成就
云开发技术峰会·公益编程挑战赛【火热报名中】!
实验5 8254定时/计数器应用实验【微机原理】【实验】
4 ans d'expérience de travail, 5 modes de communication Multi - thread ne peuvent pas être décrits, vous osez croire?
Using macro code to generate handwriting automatically in word or WPS
Abnova丨CSV 磁珠中英文说明
mysql查询时间戳转换成日期格式
动手学数据分析 数据建模和模型评估
生态护航 云服务商挥起“英特尔大旗”
Bi SQL constraints
Welcome to the new world of Lenovo smart screen
Powerbi - for you who are learning
粉丝福利,JVM 手册(包含 PDF)
Cloud development technology summit · public welfare programming challenge [hot registration]!
Go language operators (under Lesson 8)
明日考试 最后一天如何备考?二造考点攻略全整理
matlab 取整
AutoCAD - two extension modes