当前位置:网站首页>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
边栏推荐
- Lenovo tongfuyao: 11 times the general trend, we attacked the city and pulled out the stronghold all the way
- C language boundary calculation and asymmetric boundary
- Why does Dell always refuse to push the ultra-thin commercial notebook to the extreme?
- RedisTemplate操作Redis,这一篇文章就够了(一)[通俗易懂]
- 全排列II[存在相同元素去重 + 标准回溯]
- How about compass stock trading software? Is it safe?
- Bi SQL alias
- 论文翻译 | RandLA-Net: Efficient Semantic Segmentation of Large-Scale Point Clouds
- 卷积与转置卷积
- Bi-sql Union
猜你喜欢
随机推荐
“一个优秀程序员可抵五个普通程序员!”
The latest QQ wechat domain name anti red PHP program source code + forced jump to open
Tencent cloud wecity Hello 2022!
归并排序模板 & 理解
论文翻译 | RandLA-Net: Efficient Semantic Segmentation of Large-Scale Point Clouds
云开发技术峰会·公益编程挑战赛【火热报名中】!
LLVM TargetPassConfig
How much commission does CICC wealth securities open an account? Is stock account opening and trading safe and reliable?
This national day! Tencent cloud wecity will accompany you to travel and light up the city landmark
归并排序求逆序数
通达信哪个开户更安全,更好点
Introduction to bi-sql wildcards
The innovation consortium of Haihe laboratory established gbase and became one of the first member units of the innovation Consortium (Xinchuang)
Bi SQL constraints
Powerbi - for you who are learning
How about compass stock trading software? Is it safe?
Unity C# 网络学习(六)——FTP(二)
JVM directive
The optimism about technology is making Dell achieve more than expected
Bi-sql top