Search

ok, the 404 is gone but the pagination doesn’t work.

the xml of my subpage is the same as the parent. where i have to say “show the next entries”?

sorry, i know a thing or two but symphony-cms and xsl is quite new to me.

When I use this script, my inlog form doesn’t work anymore.
I use this twitter like login form.

My xslt looks like this:

<xsl:include href="../utilities/master.xsl"/>

<xsl:template match="data">
    <div class="content">
        <xsl:apply-templates select="/data/navigation" mode='breadcrumb' />
        <div>
            <h3>Vacatureoverzicht</h3>
            <xsl:apply-templates select="vacatureoverzicht"/>
        </div>
        <xsl:call-template name="pagination">
            <xsl:with-param name="pagination" select="/data/vacatureoverzicht/pagination" />
            <xsl:with-param name="pagination-url" select="'/vacatures/vacature-zoeken/$'" />
            <xsl:with-param name="show-range" select="5" />
            <xsl:with-param name="label-next" select="'volgende &#187;'" />
            <xsl:with-param name="label-previous" select="'&#171; vorige'" />
        </xsl:call-template>
    </div>
</xsl:template>

<xsl:template match="vacatureoverzicht">
    <xsl:for-each select="entry">
        <h4><a><xsl:attribute name="href"><xsl:value-of select="$root"/>/vacatures/vacature-zoeken/detail/<xsl:value-of select="vacature-naam/@handle"/></xsl:attribute><xsl:value-of select="vacature-naam"/></a></h4>
        <ul>
            <li>Functie: <xsl:value-of select="functie"/></li>
            <li>Instelling: <xsl:value-of select="instelling"/></li>
            <li>Standplaats: <xsl:value-of select="standplaats"/></li>
            <li>Aantal uren per week: <xsl:value-of select="aantal-uren-per-week"/></li>
            <li>Arbeidsovereenkomst: <xsl:value-of select="arbeidsovereenkomst"/></li>          
        </ul>
    </xsl:for-each>
</xsl:template>

When I remove the

    <xsl:call-template name="pagination">
        <xsl:with-param name="pagination" select="/data/vacatureoverzicht/pagination" />
        <xsl:with-param name="pagination-url" select="'/vacatures/vacature-zoeken/$'" />
        <xsl:with-param name="show-range" select="5" />
        <xsl:with-param name="label-next" select="'volgende &#187;'" />
        <xsl:with-param name="label-previous" select="'&#171; vorige'" />
    </xsl:call-template>

The login form works just fine.

I just implemented this template and it’s working great. Thanks Nick for the effort. I changed this section of the template so that the current page number won’t be a link:

<!-- Generate page -->
<li>
    <xsl:choose>
        <xsl:when test="$page = $page-current">
            <xsl:attribute name="class">
                <xsl:value-of select="$class-selected" />
            </xsl:attribute>
            <xsl:value-of select="$page" />
        </xsl:when>
        <xsl:otherwise>
            <a class="{$class-page}">
                <xsl:attribute name="href">
                    <xsl:call-template name="pagination-url-replace">
                        <xsl:with-param name="string" select="$pagination-url" />
                        <xsl:with-param name="search" select="'$'" />
                        <xsl:with-param name="replace" select="string($page)" />
                    </xsl:call-template>
                </xsl:attribute>
                <xsl:value-of select="$page" />
            </a>
        </xsl:otherwise>
    </xsl:choose>
</li>

Hello, I’m using SiteCore , and i want to make this XSLT in my template. my probleme that i cant see pagination in may page.aspx where is my plaseholder reference to my XSLT template (AymPager)

<sc:placeholder runat="server" key="AymPager" id="PagerPlaceholder"></sc:placeholder>

how could i make it ? please

@Bayoude: You’ve reached the Symphony CMS forum. While our system uses XSLT, the way the XML is structured and the way the XSLT files are loaded are quite different to SiteCore. Furthermore, your particular issue relates specifically to SiteCore and not necessarily a common XSLT problem, so the Symphony community do not have the expertise to help you out here.

Your best chance of getting an answer will be to ask your question at a SiteCore-related forum.

Hi All,

Im stuck with my pagination template.

 <xsl:call-template name="pagination">
                    <xsl:with-param name="pagination" select="/data/resorts/pagination" />
                    <xsl:with-param name="pagination-url" select="'/dev/kohlipe-resorts/$'" />
                    <xsl:with-param name="show-range" select="'5'" />
                    <xsl:with-param name="label-next" select="'next'" />
                    <xsl:with-param name="label-previous" select="'previous'" />     
                </xsl:call-template>

this is my structure within the list of resort items I have. Everything works fine, but if I click ‘next’ or another page, it goes 404. I don’t understand the ‘$’ handeling?

This is my XML:

<data>
<events />
<resorts>
    <pagination total-entries="13" total-pages="3" entries-per-page="5" current-page="1" />
    <section id="9" handle="resorts">Resorts</section>
    <entry id="12">
        <location handle="koh-lipe">Koh Lipe</location>      
        <price-from handle="850">850</price-from>
        <resort-description mode="formatted">This is the resort description</resort-description>
        <resort-name handle="baan-kasirin-1">Baan Kasirin 1 </resort-name>
     </entry>
  </resorts>
  </data> 

How do I make this work?

Thanks

Sandor

Your pagination URL is set to:

/dev/kohlipe-resorts/$

Which means your “kohlipe-resorts” page should allow a URL Parameter, named something like “p” or “page” (the name is up to you). The $ symbol marks where the page number will be added for example:

/dev/kohlipe-resorts/2

Have you got this URL Parameter set up? If so, it should also go into your Data Source in the “Show page {$page} of results” box.

alright I fixed it the way you said Nick

Should I also change my $pagination-url ?

nevermind it works! I got it now.

Thanks allot Nick!

Here’s another problem I have, can’t figure this one out. I have this page called ‘categories’, were 4 different categories are being displayed. If I click on one of those it adds a parameter with that category name. Now I only get the requested categories in one list. Every category has around 50 items which means they need the pagination.

The problem is, if I’m in a category e.g. ‘diving’, it counts ALL the items for every category and adds them to the pagination. How do I make sure the pagination is focused per category?

If I click on one of those it adds a parameter with that category name. Now I only get the requested categories in one list

Are you doing this filtering in your XSLT (matching strings/nodes) or in your Data Source (filtering on the field)? You should pass the category into the Data Source that lists your “items”, and the pagination totals should honour your Data Source filtering.

Are you doing this filtering in your XSLT (matching strings/nodes) or in your Data Source (filtering on the field)?

In my DS I set a param for the requested category. In my XSLT I filter the results like this to filter the results.

      <xsl:for-each select="data/activities/entry">
     <xsl:if test="activity-category/item = $category">        
       <a href="{$root}/things-to-do-on-lipe/activity-view/{activity-name/@handle}">

how do I make sure the pagination totals are included in my DS?

In my DS I set a param for the requested category. In my XSLT I filter the results like this to filter the results.

If you’re filtering in the DS then you shouldn’t need to be filtering in the XSLT surely, because the DS will only be returning correctly filtered results. DS pagination (and this XSLT utility) will only work when you’re using full DS pagination. If you’re filtering entries out using XSLT then you’ll have to write your own pagination.

aah I got it working now! very logic, thanks again Nick!

nevermind, great utility.

I have another question… When I have for example 3 pages of items sorted on alphabetical order, the first page sorts fine. Let’s say the first page shows items from A-D, then it supposed to continue on the 2nd page with E. But if I enter the second page it re-sorts the page on alphabetical order again. I want the list of items to continue properly on all of the pages. How can I do this?

This is my pagination set-up:

<xsl:call-template name="pagination">
    <xsl:with-param name="pagination" select="/data/items/pagination" />
    <xsl:with-param name="pagination-url" select="'/all-items/$'" />
    <xsl:with-param name="show-range" select="'3'" />
    <xsl:with-param name="label-next" select="'next'" />
    <xsl:with-param name="label-previous" select="'previous'" />     
</xsl:call-template>

(I use a simple for each on all the data/items/entry to get all the items. The sorting comes from the data-source.)

Thanks

Is there anyone who can help me with this problem? :)

Sounds like the data source isn’t paginating, so not a problem with XSLT. Make sure your Symphony “All Items” page has a URL Parameter to accept the page number, and make sure that the data source uses this parameter in the “Show page X of results”.

If you go to:

/all-items/1/
/all-items/2/
/all-items/3/

Do you see the results paginated correctly?

In my DS I have ‘Show page {$page} of results’ and in my all items page I specify ‘page’ as a URL Parameter.

The problem is I have 2 sorts in my XSLT and 1 is being done by the datasource since I have to specify it. What I want to achieve is sorting on:

  • First: Recommended items (datasource)
  • Second: Item Rank (sort in XSLT)
  • Third: Alphabetical order (sort in XSLT)

So First I want all the recommended items to show up on top. After that the items that have a rank should be ranked. And for the items that don’t have a rank, those should be ordered alphabetically.

If I remove the two XSLT sorts and I sort the files in the DS on item name, it works fine. But as soon as I insert more sorts the second page gets all confused and starts doing a new alphabetical order.

This is how I sort on the all items page:

<xsl:for-each select="data/entry/item">
     <xsl:sort select="item-rank" order="descending" />
       <xsl:sort select="item-name" data-type="text" order="ascending" />

Ah ;-) The XSLT pagination utility only works with data source pagination and not any addition sort you’ve added.

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