{capture}
{capture} is used to collect the output of the template between the tags into a
variable instead of displaying it. Any content between {capture
name='foo'} and {/capture} is collected into the variable specified
in the name attribute.
The captured content can be used in the
template from the variable $smarty.capture.foo
where "foo" is the value passed in the name attribute. If you do not
supply a name attribute, then "default" will be used as the name
ie $smarty.capture.default {capture}'s can be nested.
Attribute NameTypeRequiredDefaultDescriptionnamestringnodefaultThe name of the captured blockassignstringNon/aThe variable name where to assign the captured output to
Be careful when capturing {insert}
output. If you have
$caching
enabled and you have
{insert}
commands that you expect to run
within cached content, do not capture this content.
{capture} with a the name attribute
{$smarty.capture.banner}
{/if}
]]>
{capture} into a template variableThis example also demonstrates the
{popup}
function
Your ip is {$smarty.server.REMOTE_ADDR}.
{/capture}
help
]]>
See also
$smarty.capture,
{eval},
{fetch},
fetch()
and {assign}.