1

据我所知,我已经正确设置了我的部分/数据源。它设置为包括 system:pagination 并且每 3 个条目分页。

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

这是存档/类别页面:

    <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>

这是我的 ?debug 显示唯一出现的分页:

<archive-listing>
    <pagination total-entries="11" total-pages="4" entries-per-page="3" current-page="1" />

无论如何,这是解决方案。遵循 callovarne 的建议并按照他告诉我的步骤进行操作,我能够做到这一点。因此,如果您遇到该问题,请务必检查一下:

      <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, '/$')"/>

4

1 回答 1

0

检查这些以开始:

  • pagination数据源输出:在 ?debug中的元素中查找预期值
  • 该实用程序可以访问传递的参数

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

    <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>
于 2014-04-17T07:12:48.127 回答