How can I display elements with the same tag in Alchemy CMS?
I tagged some elements with the tag "logic". Now, I want to display the latest elements with this tag on another page. Is there a codeline for this? For example something like this:
<%= render_elements :from_tag => 'logic' %>
You can't use the
render_elementshelper here.But you can use plain ol' Rails and the
render_elementhelper:Alternatively without the
render_elementhelper you could just render the view partial with:But beware, that then you need to use the element's partial name as local object in your element view, because Rails uses the partial name as default local object. So, for instance, an element named
articlewith a view partial named_article_viewhas a local object namedarticle_view.If you want to keep the Alchemy element generator's default local
elementobject, you can still pass it into your view:But this reads a little bit weird, I prefer to either use the
render_elementhelper, or rename the local object in my element view.