检索 umbraco 中的媒体列表
我刚刚开始使用 umbraco 中的 XSLT 系统,我希望生成一个宏,列出特定媒体目录下的所有媒体。我遇到过 umbraco.library:GetMedia 但坦率地说,我不知道要传递给它什么才能获取项目列表。 API 文档位于 http://umbraco.org/apiDocs/html/M_umbraco_library_GetMedia.htm 似乎表明我可能想要的是查找一个节点(如何?),然后将其传递给
umbraco.library:GetMedia(<some node id>, true)
How would I go about getting that initial node id?
随后类似这样的事情会起作用吗?
<xsl:for-each select="umbraco.library:GetMedia(<SOMEMAGIC>, 'true')">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
I'm just starting to play with the XSLT system in umbraco where I was hoping to produce a macro which listed all the media under a specific media directory. I have come across umbraco.library:GetMedia but, frankly, I have no idea what to pass to it in order to get a list of items. The API docs at http://umbraco.org/apiDocs/html/M_umbraco_library_GetMedia.htm seem to suggest that what I probably want is to look up a node (how?) and then pass it in with
umbraco.library:GetMedia(<some node id>, true)
How would I go about getting that initial node id?
Subsequently would something like this work?
<xsl:for-each select="umbraco.library:GetMedia(<SOMEMAGIC>, 'true')">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下是相同的代码,但已更新以适用于 Umbraco 4.5 或更高版本:
Here's the same code but updated to work with Umbraco 4.5 or later:
感谢 umbraco 论坛上的人们的大力帮助,我找到了答案。该线程位于此处解决方案基本上是将该 XSLT
与页面上的媒体选择器控件相结合。
Thanks to some great help from the folks over at in the umbraco forums I figured it out. The thread is here and the solution is basically this XSLT
coupled with a media picker control on the page.