Created
September 27, 2012 09:34
-
-
Save 0xgdr/3793125 to your computer and use it in GitHub Desktop.
Stash Example Displaying Categories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {!-- THIS PULLS IN THE VIEW TEMPLATE (ALL THE HTML STRUCTURE) --} | |
| {embed="_views/_two_col"} | |
| {!-- USE STASH TO SET THE BANNER CONTENT --} | |
| {exp:stash:set name="banner" parse_tags="yes"} | |
| {exp:channel:entries channel="banners" url_title="events-banner" dynamic="no"} | |
| {mx_banner_images} | |
| {exp:ce_img:pair src="{mx_image}" width="920" height="435" crop="yes"} | |
| <img src="{made}" width="{width}" height="{height}" alt="" title="{mx_caption}"> | |
| {/exp:ce_img:pair} | |
| {/mx_banner_images} | |
| {/exp:channel:entries} | |
| {/exp:stash:set} | |
| {!-- USE STASH TO SET THE COL-1 CONTENT --} | |
| {exp:stash:set name="col_1" parse_tags="yes" parse_conditionals="yes" parse_depth="2"} | |
| {sn_calendar} | |
| {!-- DISPLAY THE EVENTS IN THE SELECTED CATEGORY --} | |
| {if segment_2 == "category"} | |
| {exp:channel:category_heading | |
| channel="events" | |
| } | |
| <h2>{category_name}</h2> | |
| {/exp:channel:category_heading} | |
| {exp:channel:entries | |
| channel="events" | |
| limit="5" | |
| orderby="date" | |
| sort="asc" | |
| show_future_entries="yes" | |
| } | |
| {if no_results} | |
| <h3>There are no Events at this time.</h3> | |
| {/if} | |
| <article class="event box {categories}{cat_colour}{/categories}"> | |
| <h3>{title}</h3> | |
| <time datetime="{entry_date format="%Y-%m-%d"}">{entry_date format="%d %M %Y"}</time> | |
| <div class="category"> | |
| {categories}<a href="{path='events'}">{category_name}</a>{/categories} | |
| </div> | |
| {exp:trunchtml chars="180" inline="…" } | |
| {cf_event_summary} | |
| {/exp:trunchtml} | |
| <p class="more"> | |
| <a href="{url_title_path='events/event'}" class="btn">Event Details »</a> | |
| </p> | |
| </article> | |
| {/exp:channel:entries} | |
| {/if} | |
| {!-- IF NO EVENT SELECTED DISPLAY THE COME AND SEE US CATEGORY --} | |
| {if segment_2 != "category"} | |
| <h2>Come and See Us</h2> | |
| {exp:channel:entries | |
| channel="events" | |
| limit="3" | |
| orderby="date" | |
| show_future_entries="yes" | |
| category="49" | |
| dynamic="no" | |
| } | |
| {if no_results} | |
| <h3>There are no Come and See Us Events at this time.</h3> | |
| {/if} | |
| <article class="event box {categories}{cat_colour}{/categories}"> | |
| <h3>{title}</h3> | |
| <time datetime="{entry_date format="%Y-%m-%d"}">{entry_date format="%d %M %Y"}</time> | |
| <div class="category"> | |
| {categories}<a href="{path='events'}">{category_name}</a>{/categories} | |
| </div> | |
| {exp:trunchtml chars="180" inline="…"} | |
| {cf_event_summary} | |
| {/exp:trunchtml} | |
| <p class="more"> | |
| <a href="{url_title_path='events/event'}" class="btn">Event Details »</a> | |
| </p> | |
| </article> | |
| {/exp:channel:entries} | |
| {/if} | |
| {/exp:stash:set} | |
| {!-- USE STASH TO SET THE COL-2 CONTENT --} | |
| {exp:stash:set name="col_2" parse_tags="yes"} | |
| {sn_events_nav} | |
| {/exp:stash:set} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment