MODx - 列出资源,按年分组和按月分组
我有一个关于 MODx 以及如何制作按发布年份分组和按发布月份分组的列表的具体问题。像这样的事情:
<ul>
<li>2011
<ul>
<li>May
<ul>
<li><h2>News heading</h2><p>News content</p></li>
<li><h2>News heading</h2><p>News content</p></li>
</ul>
</li>
<li>April
<ul>
<li><h2>News heading</h2><p>News content</p></li>
<li><h2>News heading</h2><p>News content</p></li>
</ul>
</li>
</ul>
<li>2010
<ul>
<li>May
<ul>
<li><h2>News heading</h2><p>News content</p></li>
<li><h2>News heading</h2><p>News content</p></li>
</ul>
</li>
<li>April
<ul>
<li><h2>News heading</h2><p>News content</p></li>
<li><h2>News heading</h2><p>News content</p></li>
</ul>
</li>
</ul>
</ul>
我查看了Archivist,但它似乎没有给我很多选择。
是否可以使用 getResources 或者我必须编写自己的代码片段?
谢谢。
I have a specific question about MODx and how to make a list that groups by publishedon Year and subgroups by publishedon Month. Something like this:
<ul>
<li>2011
<ul>
<li>May
<ul>
<li><h2>News heading</h2><p>News content</p></li>
<li><h2>News heading</h2><p>News content</p></li>
</ul>
</li>
<li>April
<ul>
<li><h2>News heading</h2><p>News content</p></li>
<li><h2>News heading</h2><p>News content</p></li>
</ul>
</li>
</ul>
<li>2010
<ul>
<li>May
<ul>
<li><h2>News heading</h2><p>News content</p></li>
<li><h2>News heading</h2><p>News content</p></li>
</ul>
</li>
<li>April
<ul>
<li><h2>News heading</h2><p>News content</p></li>
<li><h2>News heading</h2><p>News content</p></li>
</ul>
</li>
</ul>
</ul>
I looked at Archivist, but it doesn't seem to give me a lot of options.
Is it possible to use getResources or do I have to write my own snippet?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从 Archivist 1.2.0 开始,您可以使用 &groupByYear=`1` 和 &groupByYearTpl 允许在 Archivist 中按年份将结果分组到嵌套列表中。
显然,文档没有提到这一点,但这是提交:
https://github.com/splittingred/Archivist/commit/45d2cfe137a2f5904bb4b639b1c64a4eb68096 8b
Since Archivist 1.2.0, you can use &groupByYear=`1` and &groupByYearTpl to allow for grouping results by year in Archivist, into nested lists.
Apparently, the doc doesn't mention about this, but this is the commit:
https://github.com/splittingred/Archivist/commit/45d2cfe137a2f5904bb4b639b1c64a4eb680968b
这应该可以使用 getResources 实现,因为您应该能够嵌套 getResources 调用。
因此,基本上,您可以在外部 getResources 调用中获取您的年份,并在该调用的模板中包含另一个 getResources 调用。
This should be possible using getResources, as you should be able to nest getResources calls.
So basically you get your years in your outer getResources call and within the template for that call you include another getResources call.