Search

Hi there Peeps!

Is anyone willing to write a tutorial on pagination? I have seen Nick’s XSLT Datasource Pagination Utility, and can see how to add the pagination into a DataSource, but still don’t understand how to do it all together.

Do I have to do something with URL Params or something? If so, how does that work?

I think it would be a great resource to add into the current Hello Symphony tutorial for that more advanced tutorial level.

Any takers? ;)

@designermonkey - Could you explain your setup? Maybe post your xml

Also, in your datasources did you select the pagination element? If not, you’ll need to do that.

In your datasource choose a number of items per page by entering a value in the “Show a maximum of [________] results” field. Then in “Show page [__________] of results” put $url-p. Make sure to include the pagination element in your XML as well.

Now, in your XSLT for that page include the template and wherever you want to have the pagination add this XSLT:

<xsl:call-template name="pagination">
    <xsl:with-param name="pagination-element" select="/data/path/to/pagination" />
    <xsl:with-param name="display-number" select="'10'" />
    <xsl:with-param name="url" select="'/section/?p=$'" />
</xsl:call-template>

The first parameter defines the XPATH to your pagination node. The second displays the number of pages to display links for. In this example, you’d see something like:

1 2 3 4 5 6 7 8 9 … 20

Assuming there were twenty pages in total, at least. The third param is the path to give each link. I know you can do it via params on the actual page, so it’d show up as /section/$/ but I’ve never managed to get it to work and this way, while not as pretty, works every time, including with URL parameters.

Doug, thanks for the explanation!

Brian, I’m just using standard xml returned from a section with the pagination element included. Just didn’t know how to pull all this together.

I really think someone on the core team should write this up into the tutorials, or ask someone to do it on their behalf…

It’s on a list somewhere. Ah yes, here. Just not enough hours in a day!

I know the feeling! Can’t wait to see the new tutorials! Cheers Nick.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details