Skip to content

Instantly share code, notes, and snippets.

@edolyne
Created November 1, 2015 16:09
Show Gist options
  • Save edolyne/779c25c1ddc96af5e401 to your computer and use it in GitHub Desktop.
Save edolyne/779c25c1ddc96af5e401 to your computer and use it in GitHub Desktop.
NewSpring Ad Block Section Markup
{!--
We pass a number of variables to alter the output of our Ad Unit Section. The template code is currently written for use in Expression Engine but can easily be converted for use with RockRMS Lava Templates.
background_color
background_image
alignment
link_url
link_text
target
image_ratio
heading
body
--}
{if embed:entry_id != ''}
{exp:stash:setparse_tags='yes' parse_conditionals='yes' parse_depth='5' trim='yes'}
{exp:channel:entries entry_id='{embed:entry_id}' status='Open|Featured'}
{stash:entry_title}
{title}
{/stash:entry_title}
{stash:entry_image}
{entry_image}
{if embed:image_ratio == 'Square'}
{if '{entry_image_1x1}' != ''}
{entry_image_1x1}
{if:else}
{entry_image_2x1}
{/if}
{if:elseif embed:image_ratio == 'Portrait'}
{if '{entry_image_1x2}' != ''}
{entry_image_1x2}
{if:else}
{entry_image_2x1}
{/if}
{if:else}
{entry_image_2x1}
{/if}
{/entry_image}
{/stash:entry_image}
{stash:entry_body}
{exp:eehive_hacksaw chars="160" append="…"}
{entry_description}
{/exp:eehive_hacksaw}
{/stash:entry_body}
{stash:entry_link}
{path='{channel_url}/{url_title}'}
{/stash:entry_link}
{/exp:channel:entries}
{/exp:stash:set}
{/if}
<section class="{if embed:background_color == 'Grey'}section--grey {if:elseif embed:background_color == 'Dark'}section--dark {if:elseif embed:background_color == 'Black'}section--black {if:elseif embed:background_color == 'Primary'}section--primary {if:elseif embed:background_color == 'Secondary'}section--secondary {if:elseif embed:background_color == 'Tertiary'}section--tertiary {/if}"
>
<div class="shell {if embed:background_image AND embed:image == '' AND embed:entry_id == ''}overlay overlay--light {if embed:alignment == 'Centered'}overlay--solid-dark {if:elseif embed:alignment == 'Right'}overlay--gradient-right {if:else}overlay--gradient-left {/if}background--fill handheld-overlay--solid-dark{/if}" style="{if embed:background_image != '' AND embed:image == '' AND embed:entry_id == ''}background-image: url('{exp:ce_img:single src='{embed:background_image}' width='1700' crop='yes' url_only='yes'}');{/if}">
<div class="grid floating {if embed:background_image}overlay__item {/if}{if embed:alignment == 'Left'}left {if:elseif embed:alignment == 'Right'}right {if:elseif embed:alignment == 'Centered'}centered {/if} lap-centered handheld-centered">
{if embed:image != '' OR embed:entry_id != ''}<div class="grid__item floating__item one-half handheld-one-whole {if embed:alignment == 'Right'}visuallyhidden--anchored visuallyhidden--portable {/if}">
{if embed:link_url OR embed:entry_id != ''}<a href="{if embed:link_url != ''}{embed:link_url}{if:else}{exp:stash:get name='entry_link'}{/if}" target="{if embed:target == 'Yes'}_blank{/if}">{/if}<div class="{if embed:image_ratio == 'Landscape'}ratio--landscape {if:elseif embed:image_ratio == 'Square'}ratio--square {if:elseif embed:image_ratio == 'Portrait'}ratio--portrait {/if} background--fill flush" style="background-image: url('{if embed:image != ''}{exp:ce_img:single src='{embed:image}' url_only='yes'}{if:else}{exp:ce_img:single src='{exp:stash:get name='entry_image'}' url_only='yes'}{/if}');"></div>{if embed:link_url OR embed:entry_id != ''}</a>{/if}
</div>{/if}{!--
--}<div class="grid__item floating__item {if embed:image == '' AND embed:alignment == 'Centered'}two-thirds {if:else}one-half {/if}{if embed:image == ''}lap-three-quarters {/if}{if embed:alignment != 'Centered'}left{/if} handheld-one-whole">
{if embed:entry_id != '' OR embed:image != ''}
<h3>
{if embed:heading != ''}
{embed:heading}
{if:else}
{exp:stash:get name="entry_title"}
{/if}
</h3>
{if:else}
{if embed:heading != ''}
<h2>{embed:heading}</h2>
{/if}
{/if}
{if embed:body != ''}
{exp:scripturizer version='NIV'}
{embed:body}
{/exp:scripturizer}
{if:elseif embed:entry_id != ''}
<p>{exp:stash:get name="entry_body"}</p>
{/if}
{if embed:link_url != '' AND embed:link_text != '' OR embed:entry_id != ''}
<a href="{if embed:link_url != ''}{embed:link_url}{if:else}{exp:stash:get name='entry_link'}{/if}" class="{if embed:link_type == 'Text'}link--arrow {if:else}btn {/if}"{if embed:target == 'Yes'} target="_blank"{/if}>{if embed:link_text != ''}{embed:link_text}{if:else}Read More{/if}</a>
{/if}
</div>{if embed:image != '' OR embed:entry_id != ''}<div class="grid__item floating__item one-half handheld-one-whole {if embed:alignment == 'Right'}visuallyhidden--handheld {if:else}visuallyhidden {/if}">
{if embed:link_url OR embed:entry_id != ''}<a href="{if embed:link_url != ''}{embed:link_url}{if:else}{exp:stash:get name='entry_link'}{/if}"{if embed:target == 'Yes'} target="_blank"{/if}>{/if}<div class="{if embed:image_ratio == 'Landscape'}ratio--landscape {if:elseif embed:image_ratio == 'Square'}ratio--square {if:elseif embed:image_ratio == 'Portrait'}ratio--portrait {/if} background--fill flush" style="background-image: url('{if embed:image != ''}{exp:ce_img:single src='{embed:image}' url_only='yes'}{if:else}{exp:ce_img:single src='{exp:stash:get name='entry_image'}' url_only='yes'}{/if}');"></div>{if embed:link_url OR embed:entry_id != ''}</a>{/if}
</div>{/if}
</div>
</div>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment