Search

Nils, out of curiosity what did you add?

I need to look back through an example of mine to remember how I removed the initial prev link and the last next link.

The parameters that can be passed to the template are different:

# Required Parameters:

pagination:        XPath to the data source pagination element
pagination-url:    URL used for page links, use $ as placeholder for the page number

# Optional Parameters:

show-range:        Number of pages until the list gets shortened, defaults to 5
show-navigation:   Show previous or next links, defaults to true()
show-rotation:     Add rotation to next and previous links, defaults to false()
label-next:        Custom "Next" label text
label-previous:    Custom "Previous" label text

# Class options:

class-pagination:  Class used for the pagination list
class-page:        Class used for page items
class-next:        Class used for the next page link
class-previous:    Class used for the previous page link
class-selected:    Class used for the selected page
class-disabled:    Class used for the disabled page link

It’s possible to hide the next and previous navigation completely and pagination rotation is optional. Furthermore all class names used in the resulting markup are customizable.

I changed the parameter and variable names to no longer match global parameters like $current-page and I simplified the pagination-numbers template. Due to the change of parameter names you can not just drop this template in as an replacement of Nick’s original template.

Looks like you’ve done pretty much what I was going to! Mind if I replace the existing utility with this?

Of course you can use it (most of the code has been written by you).

One change I forgot to mention is that I replaced ... with … and put the whole ellipsis inside its own list item.

Suits me. Thanks! It’s on my to-do list :-)

Data Source Pagination updated to version 1.4 on 21st of May 2010

Wicked stuff!

It only took a year and 16 days to get 1.0 to 1.4. Thanks Nils :-)

It only took a year and 16 days to get 1.0 to 1.4.

lol Impressive!

hi, it doesn’t seem to be working for me. i got this error

XSLTProcessor::transformToXml(): Invalid type XSLTProcessor::transformToXml(): xmlXPathCompiledEval: 1 objects left on the stack.

that’s my xsl:

<xsl:call-template name="pagination">
    <xsl:with-param name="pagination-element" select="/data/blog/pagination" />
    <xsl:with-param name="url" select="'/blog/seite/$'" />
    <xsl:with-param name="next" select="'nächste Seite'" />
    <xsl:with-param name="previous" select="'vorherige Seite'" />
    <xsl:with-param name="display-number" select="'10'" />
</xsl:call-template>

did i use it right?

thanks to anybody for giving a hint!

Make sure you also have single quotes for your next/prev strings.

hi Nick, thanks for reply. i’m sure i have single quotes for the next/prev strings ;-)

any suggestions?

What if you change display-number to an odd number?

no improvement. still the same error

Could you post your page XML please?

Hi hbee, I figured out the probem. It’s because the in latest version of this XSLT (1.4) the parameter names have changed. You should try this:

<xsl:call-template name="pagination">
    <xsl:with-param name="pagination" select="/data/blog/pagination" />
    <xsl:with-param name="pagination-url" select="'/blog/seite/$'" />
    <xsl:with-param name="show-range" select="'9'" />
    <xsl:with-param name="label-next" select="'nächste Seite'" />
    <xsl:with-param name="label-previous" select="'vorherige Seite'" />     
</xsl:call-template>

Hi, here is an update with custom element names: http://gist.github.com/454937

It is now possible to replace the default “ul / li” with “p / span” for example.

hi Nick, it’s working now. thanks for that.

but when i click on the “next-page”-link i got a 404. where i have to customize these links?

thanks, hbee

<xsl:with-param name="pagination-url" select="'/blog/seite/$'" />

This assumes you have a page “Blog” with a sub page “Seite” that has a URL Parameter enabled for your pagination number.

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