Closed timkelty closed 10 years ago
append_list
and 'prepend_list` only allow you to add one "row" at a time; they're meant to be used inside loops.
You can however join two or more lists (each with as many rows as you like but all lists must share the same keys) with join_lists
.
{exp:stash:join_lists name="my_combined_list" lists="list_1,list_2,list3"}
I have documented that yet btw.
Ok, figured that was the case.
This approach seems to work and be the cleanest approach (this of course would make more sense when the tags were split up to their appropriate view/model templates: EE Template:
{exp:stash:set_list
name="js"
}
{stash:src}I should be last{/stash:src}
{stash:priority}100{/stash:priority}
{/exp:stash:set_list}
Layout viewModel:
{exp:stash:set_list
name="global_js"
}
{stash:src}/assets/vendor/labjs/LAB.src.js{/stash:src}
{stash:priority}0{/stash:priority}
{stash:src}//code.jquery.com/ui/1.10.3/jquery-ui.js{/stash:src}
{stash:priority}10{/stash:priority}
{/exp:stash:set_list}
{exp:stash:join_lists name="js" lists="global_js,js"}
Layout view:
{exp:stash:get_list
name="js"
orderby="priority"
sort="asc"
}
<script src="{src}"></script>
{/exp:stash:get_list}
Indeed. Clever use case there too, I like it.
And the join_lists seems to behave if js
isn't set, so that's good.
Works well! And then acutally I wrap the layout in a minimee
tag as well:
{exp:minimee:js}
{exp:stash:get_list
name="js"
orderby="priority"
sort="asc"
}
<script src="{src}"></script>
{/exp:stash:get_list}
{/exp:minimee:js}
Awesome!
Result (missing jquery-ui) :
Strangley enough, if I change the second
append_list
to aset_list
and addappend="yes"
, it gets even weirder:Should this work, or do you always have to do one at a time when using
append_list
?