首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >正面分页

正面分页
EN

Stack Overflow用户
提问于 2014-04-16 23:06:42
回答 1查看 172关注 0票数 1

据我所知,我已经正确地设置了我的部门/数据源。它被设置为包括系统:分页和每3个条目分页。

为了获得分页,我使用了一个流行的xslt实用程序

这是存档/类别页面:

代码语言:javascript
复制
    <xsl:import href="../utilities/master.xsl"/>
    <xsl:import href="../utilities/pagination.xsl"/>
    <xsl:import href="../utilities/get-article.xsl"/>
    <xsl:template match="data">

        <div class="col span-9">
            <div class="span-9">
              <h4 class="nudge-3"><xsl:value-of select="categories/entry/title[@handle = $category]"/></h4>
            </div>
              <xsl:apply-templates select="archive-listing/entry" mode="short"/>
          <xsl:call-template name="pagination">
        <xsl:with-param name="pagination" select="archive-listing/pagination"/>
            <xsl:with-param name="pagination-url" select="{$current-url}/archive/category/{title/@handle}?page=$"/>
        </div>
    </xsl:call-template>

                <div id="sidebar" class="col last span-3">
                                <xsl:call-template name="social"/>
            <xsl:call-template name="category"/>
            <xsl:call-template name="tag"/>
            <xsl:call-template name="external-links"/>
        </div>  
    </xsl:template>

</xsl:stylesheet>

下面是我的调试,显示了唯一的分页现象:

代码语言:javascript
复制
<archive-listing>
    <pagination total-entries="11" total-pages="4" entries-per-page="3" current-page="1" />

总之,这是解决方案。按照callovarne的建议,做好步骤,他告诉我我能做到这一点。所以如果你有这个问题,一定要检查一下:

代码语言:javascript
复制
      <xsl:apply-templates select="archive-listing/entry" mode="short"/>
  <xsl:call-template name="pagination">
<xsl:with-param name="pagination" select="archive-listing/pagination"/>
    <xsl:with-param name="pagination-url" select="concat($root, '/archive/category/', $category, '/$')"/>

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-04-17 07:12:48

检查这些开始:

  • 数据源输出:在调试中的pagination元素中查找期望值
  • 实用程序可以访问传递的参数。

我想您对分页模板的调用可能如下所示:

代码语言:javascript
复制
    <xsl:call-template name="pagination">
        <xsl:with-param name="pagination" select="archive-listing/pagination"/>
        <xsl:with-param name="pagination-url" select="concat($current-url, '/archive/category/', title/@handle, '?page=$')"/>
    </xsl:call-template>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23121769

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档