capture function

capture function

Usage:

Anywhere in {capture name="foo" The data between } and {/capture} will be stored in the variable $foo, which is specified by the name attribute.
Passed in the template $smarty.capture.foo accesses this variable.
If the name attribute is not specified, the function will use "default" by default As a parameter.
{capture} must appear in pairs, that is, end with {/capture}. This function cannot be nested.


##eg:

test.html:

    {#pageTitle#} 
{capture name=banner} {include file="./test1.html"} {/capture} {$smarty.capture.banner}

test1.html:

    Title 
1111111111111111

Run result:

1111111111111111


Continuing Learning
||
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!