Paging template (DS pagination)
This is an open discussion with 191 replies, filed under XSLT.
Search
Wow, seem like something not quite right as I'm bad with riddle. To make it easier for us, probably, a picture worth a thousand of words. Here the screenshot what I done previously was working great with your pagination.
Edited $url-p on homepage_articles under Blueprint > Component > Data Sources
Passing url http://localhost/xampp/symphony/?p=2
I'm able to view page 2.
Next, your suggestion that I'm to change the {$url-p} to {$my-page-parameter} in homepage-articles as shown in the screenshot?
and tried this too
no further editing is done to any xsl files and tried with the following url without success:
- http://localhost/xampp/symphony/articles/2/
- http://localhost/xampp/symphony/homepage-articles/2/
- http://localhost/xampp/symphony/home/homepage-articles/2/
- http://localhost/xampp/symphony/home/articles/2/
All I get is not found:
I believe we are closely get to the answer. Still newbie will learn faster on youtube videos. :)
You should add the parameter my-page-parameter
to the "URL Parameters" field for the Page (not the Data Source), under Blueprints > Pages. Remove it from the "Required URL Parameter". Ignore the mention of :my-page-parameter
, this is not relevant.
- See URL Parameters
oh great, nick! Thank to the debug feature, changing categories
to my-page-parameter
in the field you mentioned was the solution.
Thank for those who cleaned up my previous post.
It can be access using http://localhost/xampp/symphony/home/2/
I have a problem. I did copy the xslt to utilities. Then I make up this xslt for the search page.
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="../utilities/master.xsl"/> <xsl:import href="../utilities/zoek-article.xsl"/> <xsl:import href="../utilities/pagination.xsl"/> <xsl:template match="data"> <xsl:apply-templates select="item-search-dagboek/entry" /> <xsl:apply-templates select="item-search-frontpage/entry" /> <xsl:call-template name="pagination"> <xsl:with-param name="pagination-element" select="/data/item-search-dagboek/entry" /> <xsl:with-param name="display-number" select="'0'" /> <xsl:with-param name="url" select="'/search-page/?p=$'" /> </xsl:call-template> </xsl:template>` </xsl:stylesheet>
But now Im getting a error message when I search something. You can see it here (http://test.tamarawobben.nl/search-page/?keywords=mama)
Can anyone help me figure out what went wrong here ?
Why is display number 0? Try something like 3 or 7.
Because I only need the previous and next links.
Try something like 3 or 7.
Does this fix it? If you just want the prev/next, you could hide the rest with CSS.
Nope, the problem does still exist.
Aha:
<xsl:with-param name="pagination-element" select="/data/item-search-dagboek/pagination" />
I changed it but still the same problem.
Double check the utility, is "pagination-element" still named that it is it just "pagination"?
It's named pagination. So i have to renamed it to pagination-element ? You mean the xslt utility that I have copied to utilities ?
nobody who can help me?
Here is the comment block from the pagination utility
<!-- Name: DATA SOURCE PAGINATION Version: 1.4 Author: Nick Dunn <nick@nick-dunn.co.uk>, extended by Nils Hörrmann <post@nilshoerrmann.de> URL: http://getsymphony.com/downloads/xslt/file/20482/ 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 -->
If you read it, and then look at your template call, you will see where you have gone wrong.
Thanks, that part works now. But in my xslt I see this :
<pagination total-entries="36" total-pages="2" entries-per-page="20" current-page="1" />
In the DS I have said that I only want to display 2 articles. The comment block gives no answer to me. Must I hack this xslt to make it work like I want.
Are you sure you've set the datadource to only show 2 entries per page? I'd double check the settings there. The pagination element most probably just reflect the settings.
To display 2 entries, you need to look at your datasource, not the xslt. That's where you specify the number of entries per page.
Like I said in the previous post (176) Im talking about the datasource. In the DS I have entered that 2 post per page must be displayed. So why the pagination tag says 20 I don't know.
Well it can't do that. It reflects the value entered into the datasource Paginate results, limiting to
box. 20
is the default value.
Are you looking at the right pagination
element? Are you pointing the utility to the right pagination
element?
Create an account or sign in to comment.
Just to clear up any misconception, neither format is any more SEO-friendly than the other.
Where your datasource currently filters on
{$url-p}
(/page/?p=...
), you need to change it to something like{$my-page-parameter}
. Then find the page (e.g./articles/
) you're filtering and add a URL Parametermy-page-parameter
in Symphony. This would allow you to pass the parameter on the end of the URL in the format (/articles/:my-page-parameter
) e.g.