Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {!-- Articles --}
- {exp:stash:set_list name="articles" parse_tags="yes" parse_depth="2"}
- {exp:channel:entries
- channel="news"
- dynamic="no"
- orderby="sticky|entry_date"
- sort="desc|desc"
- sort_type="numeric|numeric"
- disable="member_data|category_fields"
- {triggers:entries}
- }
- {stash:id}{entry_id}{/stash:id}
- {stash:sticky}{sticky}{/stash:sticky}
- {stash:title}{title}{/stash:title}
- {stash:summary}{article_summary}{/stash:summary}
- {stash:date}{entry_date}{/stash:date}
- {stash:url}{page_url}{/stash:url}
- {stash:image}{article_featured_image}{/stash:image}
- {exp:stash:set_list:nested name="this_article_categories" parse_tags="yes" context="{entry_id}"}
- {categories}
- {stash:category_name}{category_name}{/stash:category_name}
- {stash:category_url_title}{category_url_title}{/stash:category_url_title}
- {/categories}
- {/exp:stash:set_list:nested}
- {/exp:channel:entries}
- {/exp:stash:set_list}
- {!-- Get Articles --}
- {exp:stash:get_list name="articles" prefix="news" paginate="bottom" limit="15"}
- <article>
- <header>
- <div class="meta">
- {news:date format="%M %j, %Y"} in {exp:stash:get_list:nested name="this_article_categories" backspace="2" context="{news:id}"}
- <a href="/news-events/news/category/{category_url_title}">{category_name}</a>,
- {/exp:stash:get_list:nested}
- </div>
- <h1 class="gamma"><a href="{news:url}">{news:title}</a></h1>
- </header>
- <div class="article-body">
- {news:summary}
- </div>
- <p class="read-more"><a href="{news:url}">Continue reading <i class="ss-gizmo ss-right"></i></a></p>
- </article>
- <hr>
- {/exp:stash:get_list}
- {!-- Desired output - no trailing comma --}
- Product 1, Products 2, Product 3
- {!-- this won't work because of the line break after the comma --}
- {exp:stash:get_list name="products" backspace="1"}
- {title},
- {/exp:stash:get_list}
- {!-- Either close the space up manually... --}
- {exp:stash:get_list name="products" backspace="1"}{title},{/exp:stash:get_list}
- {!-- ...or use the trim parameter --}
- {exp:stash:get_list name="products" trim="y"}
- {title},
- {/exp:stash:get_list}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement