Skip to content

Instantly share code, notes, and snippets.

@objectivehtml
Created June 18, 2012 20:33
Show Gist options
  • Save objectivehtml/2950536 to your computer and use it in GitHub Desktop.
Save objectivehtml/2950536 to your computer and use it in GitHub Desktop.
DRY Template Partials without native EE embeds
{exp:stash:set_value name="page_title" value="Store"}
{exp:stash:set name="page_content"}
{stash:embed name="store:search"}
{/exp:stash:set}
{stash:embed name="store:template" process="start"}
<article class="product clearfix">
<div class="wrapper">
<a href="/details/{url_title}">
<header>
<h4>{product_brand} - {product_filter_type}</h4>
<h5>{product_height}" <span class ="times">&times</span> {product_width}" <span class="times">&times</span> {product_depth}"</h5>
<span class="more"></span>
</header>
<img src="{product_front_photo}" alt="Product Name" />
</a>
<section class="actions">
<a href="#compare" class="float-left"><span class="plus">+</span>Compare</a>
<a href="/add/{entry_id}" class="float-right">Add<span class="plus">+</span></a>
</section>
</div>
</article>
{exp:data:entries
channel="products"
sort="{exp:stash:get name='sort'}"
order_by="{exp:stash:get name='order_by'}"
limit="{exp:stash:get name='limit'}"
offset="{exp:stash:get name='offset'}"
page="{exp:stash:get name='page'}"
parse="inward"
}
{if no_results}
<ul class="block-grid products">
<li><p class="empty">No results found</p></li>
</ul>
{/if}
{if is_first_row}
{if search_header}{search_header}{/if}
{/if}
<li>
{stash:embed name="store:product" process="start"}
</li>
{if is_last_row}
{if search_footer}{search_footer}{/if}
{/if}
{/exp:data:entries}
{exp:stash:set type="snippet"}
{stash:search_header}
<input type="hidden" name="current_page" value="{current_page}" />
<input type="hidden" name="total_pages" value="{total_pages}" />
<section class="clear products grid">
<div class="sort orange row">
<p class="totals float-left">{total_results} Products ({total_pages} Page{if total_pages > 0}s{/if})</p>
<form class="clearfix float-left">
<p class="margin-right">
<label for="order_by">Order By</label>
<select name="order" id="order_by">
<option value="product_brand">Brand</option>
<option value="product_display_price">Price</option>
</select>
</p>
<p class="">
<label for="sort">Sort</label>
<select name="sort" id="sort">
<option value="asc">ASC</option>
<option value="desc">DESC</option>
</select>
</p>
</form>
</div>
<div class="search-results">
<h6>Page {current_page}</h6>
<ul class="products block-grid three-up">
{/stash:search_header}
{stash:search_footer}
</ul>
</div>
<a href="#" class="more nice brown button">Next Page <span></span></a>
</section>
{/stash:search_footer}
{/exp:stash:set}
{stash:embed name="store:products" replace="yes"}
{exp:stash:get name="header" file="yes"}
{exp:stash:get name="footer" file="yes"}
{exp:stash:set name="sidebar_content"}
{exp:stash:get name="filters" file="yes"}
{/exp:stash:set}
{exp:stash:prepend name="page_content"}
{exp:stash:get name="sidebar" file="yes"}
<div class="nine columns">
<div class="wrapper clearfix">
<div class="page-title twelve columns">
<h1 class="float-left">Store</h1>
<section class="float-right">
<img src="http://placehold.it/150x75" alt="Promo" />
</section>
</div>
{/exp:stash:prepend}
{exp:stash:append name="page_content"}
</div>
</div>
{/exp:stash:append}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment