Detailed explanation of DIY parameters in discuz-x DIY tutorial [Index = x]

Source: Internet
Author: User

This post was last edited by cr180

 






In the DIY module template, there is such a judgment statement: [Index = N]... [/Index]

The following describes how to use this judgment statement!






Let's take a look at a DIY code example:
[Index = 1]
<A class = "style1" href = "{URL}" {target }>{ title} </a>
[/Index]
[Index = 2]
<A class = "style2" href = "{URL}" {target }>{ title} </a>
[/Index]
[Loop]
<A class = "style3" href = "{URL}" {target }>{ title} </a>
[Loop]






The above code is the module code used in DIY. Generally, only the green section is written in the DIY module code, and the Code such as Index = x is rarely used. You may be unfamiliar with such code.





In fact, Index = x is also a judgment statement in DIY. What is it?
Extract! Cut! Extracts the specified data from the cyclic data. The extracted data is not displayed in the loop label.

More intuitive:

A call statement reads 10 messages. The first one is red, the second one is blue, and the last eight are green.

In this way, we can use the index judgment statement to complete the process:

When the first title is currently used, use [class = "style1 "]

Use [class = "style2"] For the second title "]

For other titles, use [class = "style3 "]







In this way, we can use a single call statement to obtain multiple layout forms. From this, we can see that the considerations for DIY are still very comprehensive. The Unsupported custom SQL may involve complicated content, and the official version may be included in the plan for the next version.

Usually, judgment statements such as index may be often used in slides or advanced Template Techniques with special requirements.

Source: http://www.discuz.net/thread-1912061-1-1.html

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.