The Solution of BUG for volist Label mod in Thinkphp to Control the Line Break of Certain Record
- 2021-07-26 06:59:54
- OfStack
In this paper, an example is given to describe the solution of BUG in which volist tag mod in Thinkphp controls the newline of 1 fixed record. Share it for your reference. The specific methods are as follows:
1. BUG description:
Existing in thinkphp version 2.0
The Mod attribute is also used to control the line wrapping of 1 record, for example:
<volist name="list" id="vo" mod="5" >
{$vo.name}
<eq name="mod" value="4"><br/></eq>
</volist>
The above text is excerpted from the official manual
The actual implementation results are:
4 records in line 1 (1 missing)
Line 2 and subsequent lines are only 5 records
2. Amendments:
ThinkPHP\Lib\Think\Template\TagLib\TagLibCx.class.php
line 107 and line 108 Position Interchange 1
Original code:
$parseStr .= '++$'.$key.';';
$parseStr .= '$mod = ($'.$key.' % '.$mod.' )?>';
After modification:
$parseStr .= '$mod = ($'.$key.' % '.$mod.' );';
$parseStr .= '++$'.$key.'?>';
I hope this article is helpful to everyone's ThinkPHP framework programming.