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:
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:
I hope this article will be helpful to everyone’s ThinkPHP framework programming.
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/>
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