Skip to content

Instantly share code, notes, and snippets.

@jeremyworboys
Created October 27, 2013 21:55
Show Gist options
  • Save jeremyworboys/7188336 to your computer and use it in GitHub Desktop.
Save jeremyworboys/7188336 to your computer and use it in GitHub Desktop.
Separation of concerns with MVVM EE Stash
{!-- model.html --}
{exp:channel:entries
channel="work"
url_title="{stash:url_title}"
require_entry="yes"
{global:disable}
}
{exp:stash:set_list name="images"}
{post_carousel_images}
{stash:url}{url}{/stash:url}
{stash:alt_text}{alt_text}{/stash:alt_text}
{stash:width}{width}{/stash:width}
{stash:height}{height}{/stash:height}
{/post_carousel_images}
{/exp:stash:set_list}
{/exp:channel:entries}
{!-- view.html --}
<div class="rotator big">
<div id="rotator" class="slides">
{exp:stash:get_list name="images"}
<div class="slide">
<img src="{url}" alt="{alt_text}" width="{width}" height="{height}">
</div>
{/exp:stash:get_list}
</div>
</div>
{!-- model.html --}
{exp:channel:entries
channel="work"
url_title="{stash:url_title}"
require_entry="yes"
{global:disable}
}
{exp:stash:set_list name="images"}
{post_carousel_images}
{stash:image}<img src="{url}" alt="{alt_text}" width="{width}" height="{height}">{/stash:image}
{/post_carousel_images}
{/exp:stash:set_list}
{/exp:channel:entries}
{!-- view.html --}
<div class="rotator big">
<div id="rotator" class="slides">
{exp:stash:get_list name="images"}
<div class="slide">
{image}
</div>
{/exp:stash:get_list}
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment