我希望有一种方法可以将 Stash Context 与类别一起使用,例如,如下所示:
{exp:channel:entries channel="channel-name" dynamic="no" disable="member_data|pagination"}
{exp:stash:append_list name='list' parse_tags="yes" save="yes" scope="site" context='{categories}{category_name}{/categories}'}
{stash:this_title}{title}{/stash:this_title}
{categories}
{stash:this_category_name}
{category_name}
{/stash:this_category_name}
{/categories}
{/exp:stash:append_list}
{/exp:channel:entries}
{exp:stash:get_list name="list" parse_tags="yes" parse_conditionals="yes" context="{this_category_name}"}
<div>
all my stash variables and html etc.
</div>
{/exp:stash:get_list}
我知道我可以执行以下操作,这意味着每次添加类别时都必须有人编辑模板。
{exp:stash:get_list name="list" parse_tags="yes" parse_conditionals="yes" context="category1"}
<div>
all my stash variables and html etc.
</div>
{/exp:stash:get_list}
{exp:stash:get_list name="list" parse_tags="yes" parse_conditionals="yes" context="category2"}
<div>
all my stash variables and html etc.
</div>
{/exp:stash:get_list}
话虽如此,我的问题是:无论如何动态使用 Stash 上下文和 ExpressionEngine 类别?