This article mainly introduces the usage of the smarty built-in function capture, and analyzes the three common usage of the capture. if you need it, refer to the example in this article to describe the usage of the smarty built-in function capture. Share it with you for your reference. The specific analysis is as follows:
{Capture} can capture the output content within the tag range and coexist in the variable without displaying it. There are three usage methods,
The code is as follows:
The code is as follows:
{Capture name = "banner"} aaaaaa {/capture}
{$ Smarty. capture. banner}
{Capture assign = "foo"} bbbbbbbb {/capture}
{$ Foo}
{Capture append = "arr"} hello {/capture}
{Capture append = "arr"} world {/capture}
{Foreach $ arr as $ value}
{$ Value}
{/Foreach}
First: {capture} uses the name attribute;
Second: {capture} captures the content to the variable;
Third: {capture} captures the content to the array variable.
I hope this article will help you with php programming.