I'm getting into Stash and I wondered what the best way of handling tag pairs such as files/images?
My aim is to totally separate out the markup from the fetching of stuff from the database (exp:channel:entries tags etc). So far, this is how I'm currently handling it, and it works fine:
Model end of things (this would be within exp:channel:entries tag also with a load of other stuff).
{exp:stash:set_list name="main_image" parse_tags="yes"}
{my_image}
{stash:url}{url}{/stash:url}
{stash:height}{height}{/stash:height}
{stash:width}{width}{/stash:width}
{stash:title}{title}{/stash:title}
{/my_image}
{/exp:stash:set_list}
Markup end of things
{exp:stash:get_list name="main_image"}
<img src="{url}" height="{height}" width="{width}" alt="{title}" title="{title}" />
{/exp:stash:get_list}
What concerns me the most is I'm using a list even though there will only ever be one thing in it, as thus it makes me a bit uneasy.
Is there a better way of doing it? Like I said it definitely works, I just want to make sure I'm doing it right.