Capture in Smarty


{capture} is used to collect the output of the template between the tags into a variable.

All content between {capture name='test'} and {/capture} would into the variable in specified catpure name.

The captured content can be used in the template from the variable {$smarty.capture.test} where “test” is the name of that capture.

If we don’t provide the name attribute, then “default” will be used as the name.

{capture name="test"}

Hello World

{/capture} {$smarty.capture.test}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s