thinkphp template range Judging output in label and range label Usage _php Tutorial

Source: Internet
Author: User
The in label and range tags of the thinkphp template are used for determine if a template variable is within a range
1.in Label
The in tag of the thinkphp is used for a template variable within a range, using the following format:

 
  
   
  The content to output
 
  

When used, set variables and assign values to the template in a module operation (such as Index/display):

$groupId = 1; $this->assign ("GroupId", $groupId);

Template/tpl/default/index/display.html, use the in tag usage as follows:

 
  
   
  Manage groups
 
  

To run the example, you can output:

Manage groups

The PHP code for this example is equivalent to:

<?phpif (($groupId), explode (', ', ' In_array ')) {  echo ' management group ';}? >

Note: The value of a variable can also be a string or an array, and the value of the property can use a variable.

2.notin Label

There is also a notin tag corresponding to the in tag, that is, the judgment is not within a certain range:
Usage such as:

 
  
   
  Non-Administrative Groups
 
  

The combination of the two tag examples above is equivalent to:

 
  
   
  Manage group
  
    non-admin groups
 
  

3.range Label

thinkphp in and Notin tags can also be replaced with a range tag, such as:

 
  
   
  Manage groups
 
  

The above example is equivalent to the in tag, which is equivalent to the Notin label when the value of the Type property is Notin.

http://www.bkjia.com/PHPjc/824717.html www.bkjia.com true http://www.bkjia.com/PHPjc/824717.html techarticle the in label and range tags of the thinkphp template are used to determine whether a template variable is within a range. The in tag of the 1.in tag thinkphp is used for a template variable within a range ...

  • 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.