thinkphp 3.2.2 Use if to determine tags in volist multi-loop nesting

Source: Internet
Author: User

Today in the thinkphp 3.2.2 try to use multiple loops in the template, to the corresponding categories under the corresponding articles are sequentially loop out, but in any case can only loop out the category, the category of the article can not be recycled, ( error ) code as follows:

                <volistname= "List"ID= "Vo">                    <TRclass= ' {$vo. help_category_id} '>                        <TD>{$vo. help_category_id}</TD>                        <TDclass= ' Display_name '>{$vo. Display_name}</TD>                        <TD></TD>                        <TD></TD>                        <TD>                            <spanclass= ' Addtopic '>                                <ahref= ' # 'onclick= "return false">What's new</a>                            </span>                                                        <spanclass= ' cate_enabledstate{$vo. is_enabled} '>                                <ahref= ' # 'onclick= "return false"><ifcondition= "$vo [' is_enabled '] eq 1">Time out<Else/>Enable</if></a>                            </span>                                                        <spanclass= ' '>                                <ahref= ' # '>Delete</a>                            </span>                        </TD>                    </TR>                    <!--Looping Articles -                    <volistname= "Topic_list"ID= "Topic_vo">                        <if condition= "$topic _vo.help_category_id eq $vo. help_category_id" >                            <TR>                                <TD>{$topic _vo.topic_id}</TD>                                <TD></TD>                                <TD>{$topic _vo.title}</TD>                                <TD>{$topic _vo.priority}</TD>                                <TD><span>Edit</span> <span>Time out</span> <span>Delete</span></TD>                            </TR>                        </if>                    </volist>                </volist>

The code for the Red magnified font is the error code. To properly remove the data, you should change the code to red:

<if condition= "$topic _vo[' help_category_id '] eq $vo [' help_category_id ']" >

Report:

"ThinkPHP3.2.2 fully developed manual CHM 2014-04-14":

Since the condition attribute of the IF tag is basically PHP syntax , it is more concise to use the judgment tag and the switch tag as much as possible, in principle, it can be solved with switch and comparison label as far as possible without using the IF tag. Because switch and comparison tags can use variable adjusters and system variables. If the IF tag still does not meet the requirements under certain special requirements, you can write the code directly using native PHP code or PHP tags.

thinkphp 3.2.2 Use if to determine tags in volist multi-loop nesting

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.