Usage analysis of smarty built-in function capture, smartycapture
The example in this article describes the usage of smarty’s built-in function capture. Share it with everyone for your reference. The specific analysis is as follows:
{capture} can capture the output content within the tag range and store it in a variable without displaying it. There are three ways to use it,
The code is as follows:
Copy code The code is as follows:
{capture name="banner"}aaaaaa{/capture}
{$smarty.capture.banner}
{capture assign="foo"}bbbbbb{/capture}
{$foo}
{capture append="arr"}hello{/capture}
{capture append="arr"}world{/capture}
{foreach $arr as $value}
{$value}
{/foreach}
The first one: {capture} uses the name attribute;
The second type: {capture} captures content into variables;
The third type: {capture} captures the content into an array variable.
I hope this article will be helpful to everyone’s PHP programming design.
http://www.bkjia.com/PHPjc/946754.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/946754.htmlTechArticleSmarty built-in function capture usage analysis, smartycapture This article describes the usage of smarty built-in function capture with examples. Share it with everyone for your reference. The specific analysis is as follows: {capture} can capture...