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