0 users online. Create an account or sign in to join them.Users

Search

I seem to be all about the query strings at the moment. Sorry about that, project constraints... :P

Using Nick's Pagination Utility and pagination set in the data-source {$url-p} I can get pagination working when I just append ?p=1 to the URL or when I manually append it to the end of the query string (in the URL bar) but I'm not sure of how to change the XSLT syntax to append the pagination to any query string rather than replace it (&p=1).

To clarify, I have a query string with multiple params set:

domain.com/list?key1=value1&key2=value2&key3=value3

This data source for this page is set to paginate. I need the links of Nicks Pagination Utility to link to append the pagination link to the URL params and not replace it:

domain.com/list?key1=value1&key2=value2&key3=value3&p=2

Not:

domain.com/list?p=2

Couldn't you just add your other parameters to the pagination-url parameter?

To add to Nils' comment:

Look in /?debug. You will see $current-query-string

Then you can use a string replace template.

You can give it the string $current-query-string replace concat('&p=', $url-p) with `` (empty).

So you will go from

?key1=value1&key2=value2&key3=value3&p=2

to

?key1=value1&key2=value2&key3=value3

And you can pass this as your pagination-url

If possible, I would recommend you use a param on your page so you could just do /list/2/?querystring

Thanks for the tips guys, I've taken a look into this but I'm not quite putting 2 + 2 together. Can you provide an example of adding the other params to the pagination-url?

@Pat. Sounds interesting but I'm not completely following. Can you provide an example of how I can incorporate the string replace template for use with the pagination utility?

By the way, the query string params will be dynamic as they're submitted via a front-end search form submission.

Thanks

I've run into this before, in my case I had both required and optional params, the way I solved it can be seen in this snippet - basically I started by concating the required param names with their dynamic $url- partners, then for any optional params add a trailing if block that concats those pairs onto the href. Hope that makes sense...

Thanks for the tips guys. They all got me to thinking of how to best approach it. In the end the cleanest option was to modify the pagination utility so that it now (optionally) handles query string parameteres (or not).

I've published a gist with examples included.

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