Skip to content

Instantly share code, notes, and snippets.

@1stevengrant
Last active December 16, 2015 01:19
Show Gist options
  • Save 1stevengrant/5354836 to your computer and use it in GitHub Desktop.
Save 1stevengrant/5354836 to your computer and use it in GitHub Desktop.
example of using Stash to replace image slugs
{sn_header}
{sn_mast}
<div class="container-fluid">
<div class="row-fluid">
<div class="span3">
{sn_sub}
</div><!--/span-->
<div class="span9">
{sn_breadcrumb}
{exp:channel:entries {gv_param_disable_default}}
<!--
{cf_content_related_documents:total_children}
{cf_content_related_content:total_children}
{cf_content_contact:total_children}
{cf_content_cta:total_children}
-->
<h1>{title}</h1>
{exp:ce_img:single src="{cf_content_hero_image}" allow_scale_larger="yes" width="1067"}
{cf_content_intro}
{cf_content_body_images}
{exp:stash:set type="snippet"}
{stash:image_{row_count}}
{exp:ce_img:single src="{image_file}" width="{width}" alt="{alt}"}
{/stash:image_{row_count}}
{/exp:stash:set}
{/cf_content_body_images}
{exp:stash:parse process="end"}
{cf_content_body}
{/exp:stash:parse}
{if "{cf_content_related_content:total_children}" >= '1'}
<h2>Related content</h2>
<ul class="related-content">
{cf_content_related_content}
<li><a href="{page_url}">{title}</a></li>
{/cf_content_related_content}
</ul>
{/if}
{if "{cf_content_related_documents:total_children}" >= '1'}
<h2>Related documents</h2>
<ul class="related-content">
{cf_content_related_documents}
<li><a href="{cf_document_file:url}">{title}</a></li>
{/cf_content_related_documents}
</ul>
{/if}
{if "{cf_content_contact:total_children}" >= '1'}
<div class="contact alert alert-block">
<h2>Contact</h2>
{cf_content_contact limit="1"}
<p>{cf_staff_first_name} {title}</p>
{if cf_staff_position}
<p><strong>Job:</strong> {cf_staff_position}</p>
{/if}
{if cf_staff_extension}
<p><strong>Ext:</strong> {cf_staff_extension}</p>
{/if}
{if cf_staff_email}
<p><strong>Email:</strong> {cf_staff_email}</p>
{/if}
{/cf_content_contact}
</div>
{/if}
{if "{cf_content_cta:total_children}" >= '1'}
{cf_content_cta}
<div class="cta alert alert-info">
{if cf_cta_intro}
<p>{cf_cta_intro}</p>
{/if}
{if cf_cta_link}
<a href="{cf_cta_link}">{title}</a>
{/if}
</div>
<!-- / cta -->
{/cf_content_cta}
{/if}
{/exp:channel:entries}
</div><!--/span-->
</div><!--/row-->
{sn_footer}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment