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}

Share and Enjoy

  • Facebook
  • Twitter
  • Google Plus
  • Live
  • Delicious
  • Digg
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS
  • Instapaper
  • FriendFeed