-
Notifications
You must be signed in to change notification settings - Fork 20
{exp:stash:block}
Mark Croxton edited this page Jun 8, 2015
·
17 revisions
Retrieve a variable value. If the variable has no value, the tagdata enclosed by the tag is returned.
{exp:stash:block name="my_var"}Fallback value{/exp:stash:block}
{!-- Blocks can also be nested, by appending a unique 4th tagpart to nested tags --}
{exp:stash:block name="page_content"}
<div class="content">
<div class="body" role="main">
{exp:stash:block:nested name="page_body"}
<h1 class="entry-title">{exp:stash:title}</h1>
{exp:stash:body}
{/exp:stash:block:nested}
</div>
<div class="sidebar">
{exp:stash:sidebar}
</div>
</div>
{/exp:stash:block}
A 4th tagpart can optionally be used in place of the name=""
parameter, for a more concise syntax. For example this creates a variable with the context 'block' and the name 'page_content'.
{exp:stash:block:page_content}
...
{/exp:stash:block:page_content}
Accepts the same parameters as {exp:stash:get}, and:
Require that one or more variables/blocks exist before the block is output. In the following example the outermost block is only output when the 'alert' variable has a value:
{exp:stash:block:alert_wrap requires="alert"}
<div class="footer-panel">
<div class="layout-container">
<div class="layout-row">
<div class="layout-item col-footer-panel">
{exp:stash:get name="alert"}
</div>
</div>
</div>
</div>
{/exp:stash:block:alert_wrap}
Getting started
Using Stash
Using Mustash
- Mustash
- Installing Mustash
- Managing variables
- Managing bundles
- Cache-breaking rules
- Mustash plugins
- Mustash Varnish plugin
- Mustash plugin development
- Mustash API
Template design patterns
Tag reference
- {exp:stash:set}
- {exp:stash:get}
- {exp:stash:block}
- {exp:stash:set_value}
- {exp:stash:append}
- {exp:stash:append_value}
- {exp:stash:prepend}
- {exp:stash:prepend_value}
- {exp:stash:copy}
- {exp:stash:context}
- {exp:stash:is_empty}
- {exp:stash:not_empty}
- {exp:stash:set_list}
- {exp:stash:get_list}
- {exp:stash:append_list}
- {exp:stash:prepend_list}
- {exp:stash:split_list}
- {exp:stash:join_lists}
- {exp:stash:list_count}
- {exp:stash:unset}
- {exp:stash:flush_cache}
- {exp:stash:bundle}
- {stash:embed}
- {exp:stash:extend}
- {exp:stash:parse}
- {exp:stash:cache}
- {exp:stash:static}
- {exp:stash:finish}
- {exp:stash:not_found}
- Short tag syntax
- Using Stash methods in your own add-ons