This page last changed on Sep 30, 2011 by kristin.bradley@involver.com.
Overview
Captures the result of SML code to a variable, instead of rendering it to the screen.
Examples
{% capture capitalized_item_title %}Widget{% endcapture %}
{{ capitalized_item_title }}
Assuming item.title is "widget" would result in:
Note: Capture tag will capture ANY whitespaces or linebreaks between the opening and closing tags. This may produce unexpected results. For best practices, keep everything from capture to endcapture on the same line.
For example, this will work as intended:
{% capture image_src %}{% editable_image name: "logo" src_only: true %}{% endcapture %}
However this won't:
{% capture image_src %} {% editable_image name: "logo" src_only: true %}{% endcapture %}
|