Solution to the line break bug of certain records controlled by the volist tag mod in Thinkphp, thinkphpvolist_PHP tutorial

WBOY
Release: 2016-07-13 10:15:15
Original
996 people have browsed it

The volist tag mod in Thinkphp controls the newline BUG solution for certain records, thinkphpvolist

The example in this article describes the solution to the line break bug of certain records controlled by the volist tag mod in Thinkphp. Share it with everyone for your reference. The specific method is as follows:

1. BUG description:

Exists in thinkphp 2.0 version

Mod attribute is also used to control the line wrapping of certain records, for example:

Copy code The code is as follows:

{$vo.name}



The above text is excerpted from the official manual

The actual execution result is:
First row 4 records (one missing)
The second row and subsequent rows only have 5 records

2. Modification comments:

ThinkPHPLibThinkTemplateTagLibTagLibCx.class.php
Swap the positions of line 107 and line 108
Original code:

Copy code The code is as follows:
$parseStr .= '++$'.$key.';';
$parseStr .= '$mod = ($'.$key.' % '.$mod.' )?>';

After modification:
Copy code The code is as follows:
$parseStr .= '$mod = ($'.$key.' % '.$mod.' ) ;';
$parseStr .= '++$'.$key.'?>';

I hope this article will be helpful to everyone’s ThinkPHP framework programming.

About thinkphp’s volist line wrapping problem

You try this

{$vo.title}

< if condition="($k-1)%5==4 and $k!=$count">
//The first 5 is equivalent to the 5 in your mod, and the last 4 is equivalent to your value 4 inside, $count is the total number of statistics (output using assign in the method)





You can also try the following method ($count is the same as above)

{$vo.title}< ;br/>



How to set the auto-incrementing serial number in thinkphp’s volist tag? I hope the page can be displayed like this. Singles 1, 2, and 3 are not taken out from the database

Please check the official documentation of thinkphp, Chapter 8 Template Engine, Section 9 Volist tag, which mentions that there is a key attribute in the volist attribute, original text:
key (optional): loop key variable, default value For i, this is your auto-incrementing serial number, and the default variable is $i, which means that within your volist tag, you can directly use $i
// Use $i directly

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/906107.htmlTechArticleThe volist tag mod in Thinkphp controls the newline BUG solution for certain records, thinkphpvolist This article describes the volist tag mod in Thinkphp as an example Solution to the line wrapping bug that controls certain records. Share...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template