下一页 umbraco 新闻文章中的上一个导航
这让我有点疯狂(已经尝试这样做很长一段时间了)
我试图让一些 xpath 代码工作,它将显示下一个和上一个链接,这将带你到下一个 newsItem,一旦它到达 newsItem4 ,然后下一个按钮消失。
<newsArea>
<newsItem1></newsItem1> <----- currentPage
<newsItem2></newsItem2>
<newsItem3></newsItem3>
<newsItem4></newsItem4>
</newsArea>
我可以在新闻项目上列出所有新闻项目
<xsl:for-each select="$currentPage/../*">
<h2><xsl:value-of select="@nodeName"/></h2>
</xsl:for-each>
,并且我可以计算我有多少项目
<xsl:value-of select="count($currentPage/../*)-1"/>
,但我不知道如何移动到下一个新闻项目,或者如何告诉它何时停止显示下一个节点newsItems 的末尾(一个示例刚刚跳到另一级别)
任何帮助将非常非常感激。
谢谢蒂姆
This is driving me a little crazy (been trying to do this for quite some time)
I'm trying to get some xpath code working that will display next and previous links, which will take you to the next newsItem and once it gets to newsItem4, then the next button disappears.
<newsArea>
<newsItem1></newsItem1> <----- currentPage
<newsItem2></newsItem2>
<newsItem3></newsItem3>
<newsItem4></newsItem4>
</newsArea>
I can list al the newsItems whilst on a news item with
<xsl:for-each select="$currentPage/../*">
<h2><xsl:value-of select="@nodeName"/></h2>
</xsl:for-each>
and i can count how many items i have
<xsl:value-of select="count($currentPage/../*)-1"/>
but i dont know how to move to the next news item, or how to tell it when to stop showing the next node when it comes to the end of the newsItems (one example just jummped to another leve)
Any help would be really really appreciated.
Thanks
Tim
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看此博客文章中的分页示例:http://www.nibble.be/?p =11
这应该让您了解它是如何工作的。您始终可以将页面大小设置为 1。
此外,还有一个基于该方法的包: http://our.umbraco.org/projects/developer-tools/paging-xslt
这应该会让您走上正确的道路。
Take a look at the paging sample from this blog post: http://www.nibble.be/?p=11
That should give you an idea of how it works. You could always set your page size to 1.
Also, there is a package based on that method: http://our.umbraco.org/projects/developer-tools/paging-xslt
That should get you on the right path.
您可以轻松创建一个“页面导航”宏,将其添加到您想要的任何模板的底部,XSLT 如下所示:
You could easily create a "Page Navigation" macro to add to the bottom of any template you want it, XSLT would be as follows: