Public Library-nested learning notes six volist

Source: Internet
Author: User
Nested use of volist

 

1. An important feature is that if the volist name corresponds to an array, it will traverse the array.
For example

<Volist name = "Comments" id = "VO">
Xxx
</Volist>
While

$ Comments [0] = $ comment1;
$ Comments [1] = $ comment2;
Then the above Code will first treat $ comment1 as vo and execute the code XXX again;
Then, use $ comment2 as vo and execute XXX again.
So when you draw a comment box, as long as the above code, it will automatically draw all the comment boxes.

2. If nested, use the following method to obtain the nested content:

$ Comments [0] = $ comment1; $ comments [1] = $ comment2; $ comment1 ["ID"] = 1; $ comment1 ["content"] = "comment"; $ comment1 ["replies"] = $ replies; $ replies [0] = $ reply1; $ replies [1] = $ reply2; $ reply1 ["name"] = "DD"; $ reply2 ["name"] = "mm ";

To obtain the name values of reply1 and reply2:

<volist name="comments" id="vo">  <volist name="vo[‘replies‘]" id="sub">    {sub.name}  </volist></volist>

Because both comments and replies are arrays, automatic traversal is performed twice.

First comments1, then reply1 outputs dd; then reply2 outputs mm;

Then comments2, because there is no replies in comments2, It is not output.

 

Public Library-nested learning notes six volist

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.