Advertisement
Guest User

Untitled

a guest
Aug 1st, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. {!-- Articles --}
  2. {exp:stash:set_list name="articles" parse_tags="yes" parse_depth="2"}
  3. {exp:channel:entries
  4. channel="news"
  5. dynamic="no"
  6. orderby="sticky|entry_date"
  7. sort="desc|desc"
  8. sort_type="numeric|numeric"
  9. disable="member_data|category_fields"
  10. {triggers:entries}
  11. }
  12. {stash:id}{entry_id}{/stash:id}
  13. {stash:sticky}{sticky}{/stash:sticky}
  14. {stash:title}{title}{/stash:title}
  15. {stash:summary}{article_summary}{/stash:summary}
  16. {stash:date}{entry_date}{/stash:date}
  17. {stash:url}{page_url}{/stash:url}
  18. {stash:image}{article_featured_image}{/stash:image}
  19.  
  20. {exp:stash:set_list:nested name="this_article_categories" parse_tags="yes" context="{entry_id}"}
  21. {categories}
  22. {stash:category_name}{category_name}{/stash:category_name}
  23. {stash:category_url_title}{category_url_title}{/stash:category_url_title}
  24. {/categories}
  25. {/exp:stash:set_list:nested}
  26. {/exp:channel:entries}
  27. {/exp:stash:set_list}
  28.  
  29. {!-- Get Articles --}
  30. {exp:stash:get_list name="articles" prefix="news" paginate="bottom" limit="15"}
  31. <article>
  32. <header>
  33. <div class="meta">
  34. {news:date format="%M %j, %Y"} in {exp:stash:get_list:nested name="this_article_categories" backspace="2" context="{news:id}"}
  35. <a href="/news-events/news/category/{category_url_title}">{category_name}</a>,
  36. {/exp:stash:get_list:nested}
  37. </div>
  38. <h1 class="gamma"><a href="{news:url}">{news:title}</a></h1>
  39. </header>
  40. <div class="article-body">
  41. {news:summary}
  42. </div>
  43. <p class="read-more"><a href="{news:url}">Continue reading <i class="ss-gizmo ss-right"></i></a></p>
  44. </article>
  45.  
  46. <hr>
  47.  
  48. {/exp:stash:get_list}
  49.  
  50. {!-- Desired output - no trailing comma --}
  51. Product 1, Products 2, Product 3
  52.  
  53. {!-- this won't work because of the line break after the comma --}
  54. {exp:stash:get_list name="products" backspace="1"}
  55. {title},
  56. {/exp:stash:get_list}
  57.  
  58. {!-- Either close the space up manually... --}
  59. {exp:stash:get_list name="products" backspace="1"}{title},{/exp:stash:get_list}
  60.  
  61. {!-- ...or use the trim parameter --}
  62. {exp:stash:get_list name="products" trim="y"}
  63. {title},
  64. {/exp:stash:get_list}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement