Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Adi 79 posts 183 karma points
    Jan 25, 2014 @ 15:38
    Adi
    0

    Separating 10 articles per page?

    Hello,

    I can't find anywhere on Umbraco CMS very useful option which I have used before while using CMS like Drupal and Joomla. I kindly ask you to first look at the photo in attachment.

    articles per page

    As you can see I would like to have option which will limit number of displayed articles in list. For example I would like to see 10 articles per page. Is this possible on Umbraco CMS because I cant find it anywhere under Macros?

    Any help is appreciated and many thanks in advance for prompt reply! Adi

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jan 25, 2014 @ 21:00
    Dennis Aaen
    0

    Hi Adi,

    For some reason I couldn't write a comment on the other post, so you will get it here.

    Try this one, I get no error when I save this version.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:msxml="urn:schemas-microsoft-com:xslt"
        xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:Examine="urn:Examine"
        exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets Examine ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">
    <xsl:variable name="about" select="umbraco.library:GetXmlNodeById('1067')"/><!-- Here is the NodeId from here you are pulling all the list of about -->

    <xsl:variable name="itemsToDisplay" select="10"/> <!-- Number of items to display per page -->
    <xsl:variable name="numberOfItems" select="count($about/*[@isDoc][not(umbracoNaviHide =1)])"/>
    <xsl:variable name="jump" select="$itemsToDisplay * $pageNumber" />

    <!-- Paging -->
    <xsl:variable name="pageNumber">
      <xsl:choose>
        <xsl:when test="umbraco.library:RequestQueryString('page') = ''">
          <xsl:value-of select="1"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="umbraco.library:RequestQueryString('page')"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>       
       
    <xsl:template match="/">
    <!-- start writing XSLT -->
      <ul>
      <xsl:for-each select="$news/*[@isDoc][not(umbracoNaviHide =1)]">
        <xsl:if test="position() &lt; $jump and position() &gt;= ($jump - $itemsToDisplay)">
           <li><xsl:value-of select="@nodeName"/></li> 
         </xsl:if>  
      </xsl:for-each>
    </ul>

     
      <xsl:call-template name="for.loop">
      <xsl:with-param name="i">1</xsl:with-param>
      <xsl:with-param name="count" select="ceiling($numberOfItems div $itemsToDisplay)"></xsl:with-param>
    </xsl:call-template> 
     
     
      </xsl:template>
     
        <xsl:template name="for.loop">
                    <xsl:param name="i"/>
                    <xsl:param name="count"/>
                   
                    <xsl:if test="$i &lt;=$count">
                            <xsl:if test="$pageNumber!= $i">
                                    <a href="?page={$i}#about" ><xsl:value-of select="$i" /></a>
                            </xsl:if>

                            <xsl:if test="$pageNumber = $i">
                              <a  class="selected"><xsl:value-of select="$i"/></a>
                            </xsl:if>

                            <xsl:call-template name="for.loop">
                                    <xsl:with-param name="i" select="$i + 1" />
                                    <xsl:with-param name="count" select="$count">
                                    </xsl:with-param>
                            </xsl:call-template>
                    </xsl:if>
    </xsl:template>
    </xsl:template>

    </xsl:stylesheet>

    Hope it will work for you too.

    /Dennis

  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 26, 2014 @ 06:21
    Fuji Kusaka
    0

    Hi Weird i get the same issue and cant reply on the other threat. :)

    Anyways sorry was my mistake where i commented the first part of the variable.

    <xsl:variablename="about"select="umbraco.library:GetXmlNodeById('1067')"/><!-- Here is the NodeId from here you are pulling all the list of about -->

    instead of 

    <xsl:variablename="about"select="umbraco.library:GetXmlNodeById('1067')"/><!-- Here is the NodeId from here you are pulling all the list of about -- >

    @Dennis however the loop here should be $about but its on mine again!

    <ul>
     
    <xsl:for-eachselect="$about/*[@isDoc][not(umbracoNaviHide =1)]">
       
    <xsl:iftest="position() &lt; $jump and position() &gt;= ($jump - $itemsToDisplay)">
           
    <li><xsl:value-ofselect="@nodeName"/></li>  
         
    </xsl:if>  
     
    </xsl:for-each>
    </ul>

     

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 26, 2014 @ 06:30
    Fuji Kusaka
    0

    It should get you working now, i have just tried the code myself.

    You can also add a Next or Previous Page url to your paging.

     <xsl:if test="$pageNumber &gt; 1">
    <a href="?page={$pageNumber -1}#about" >Previous</a>
    </xsl:if>
      <xsl:call-template name="for.loop">
    <xsl:with-param name="i">1</xsl:with-param>
    <xsl:with-param name="count" select="ceiling($numberOfItems div $itemsToDisplay)"></xsl:with-param>
    </xsl:call-template>  
    <xsl:if test="(($pageNumber) * $itemsToDisplay) &lt; ($numberOfItems)">
    <a href="?page={$pageNumber+1}#about">Next;</a>
    </xsl:if>

    //Fuji

  • Adi 79 posts 183 karma points
    Jan 26, 2014 @ 16:58
    Adi
    0

    Hi Dennis,

    I have used code you suggested from last post on this thread but unforunately I get this error

    page number error

    I don't understand why only on my website pageNumber isn't defined and or your exapmle it is working fine.. What am I doing wrong?

    Best regards, Adi

  • Adi 79 posts 183 karma points
    Jan 26, 2014 @ 17:03
    Adi
    0

    Hello Fuji,

    thank you for promt reply and fast switching to this topic, I really appreciate it.

    I will try you suggestion as soon as find out why I see error which I have described in post above.

    All the best, Adi

  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 26, 2014 @ 19:55
    Fuji Kusaka
    100

    Hi Adi,

    From the error you posted before looks like you are not using the code properly.

    Can you try this please ?

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:umbraco.contour="urn:umbraco.contour" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets umbraco.contour PS.XSLTsearch ">


    <xsl:output method="html" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>
    <xsl:variable name="about" select="umbraco.library:GetXmlNodeById('2343')"/><!-- Here is the NodeId from here you are pulling all the list of about -->

    <xsl:variable name="itemsToDisplay" select="2"/> <!-- Number of items to display per page -->
    <xsl:variable name="numberOfItems" select="count($about/*[@isDoc][not(umbracoNaviHide =1)])"/>
    <xsl:variable name="jump" select="$itemsToDisplay * $pageNumber" />


        
    <!-- Paging -->
    <xsl:variable name="pageNumber">
      <xsl:choose>
        <xsl:when test="umbraco.library:RequestQueryString('page') = ''">
          <xsl:value-of select="1"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="umbraco.library:RequestQueryString('page')"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>       
       
    <xsl:template match="/">
    <!-- start writing XSLT -->
      <ul>
      <xsl:for-each select="$about/*[@isDoc][not(umbracoNaviHide =1)]">
        <xsl:if test="position() &lt; $jump and position() &gt;= ($jump - $itemsToDisplay)">
           <li><xsl:value-of select="@nodeName"/></li> 
         </xsl:if>  
      </xsl:for-each>
    </ul>

     
      <xsl:call-template name="for.loop">
      <xsl:with-param name="i">1</xsl:with-param>
      <xsl:with-param name="count" select="ceiling($numberOfItems div $itemsToDisplay)"></xsl:with-param>
    </xsl:call-template> 
     
     
      </xsl:template>
     
        <xsl:template name="for.loop">
                    <xsl:param name="i"/>
                    <xsl:param name="count"/>
                   
                    <xsl:if test="$i &lt;=$count">
                            <xsl:if test="$pageNumber!= $i">
                                    <a href="?page={$i}#about" ><xsl:value-of select="$i" /></a>
                            </xsl:if>

                            <xsl:if test="$pageNumber = $i">
                              <a  class="selected"><xsl:value-of select="$i"/></a>
                            </xsl:if>

                            <xsl:call-template name="for.loop">
                                    <xsl:with-param name="i" select="$i + 1" />
                                    <xsl:with-param name="count" select="$count">
                                    </xsl:with-param>
                            </xsl:call-template>
                    </xsl:if>
    </xsl:template>

    </xsl:stylesheet>

    I just tried that and it worked for me.

    //Fuji

  • Adi 79 posts 183 karma points
    Jan 26, 2014 @ 20:34
    Adi
    0

    Hello Fuji,

    yes, you were riht, I noticed the changes you made in your code and now I understand what was the (simple) issue;(

    However, I have good news, code is working but I will have to make some adjustments in order to achieve what I really need on my template.

    This is the code which shows active articles on every Textpage of my template.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet 
      version="1.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:msxml="urn:schemas-microsoft-com:xslt" 
      xmlns:umbraco.library="urn:umbraco.library"
      exclude-result-prefixes="msxml umbraco.library">
    
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    
    <xsl:param name="currentPage"/>
    
    <xsl:template match="/">
    
      <xsl:variable name="items" select="$currentPage/ancestor-or-self::* [@isDoc and @level = 2]/* [@isDoc and string(umbracoNaviHide) != '1']"/>
    
    <!-- The fun starts here -->
    
    <xsl:if test="count($items) &gt; 0">
    <ul>
    <xsl:for-each select="$items">
      <li>
        <a href="{umbraco.library:NiceUrl(@id)}">
          <xsl:value-of select="@nodeName"/>
        </a>
      </li>
    </xsl:for-each>
    </ul>
        </xsl:if>
    
    </xsl:template>
    
    </xsl:stylesheet>
    

    I use Textapges all the time. Is it possible to simply update this code with code you suggested? This would be almost perfect solution for my template..

    All the best, Adi

  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 26, 2014 @ 21:06
    Fuji Kusaka
    0

    Hi Adi,

    If you want to display only doc with a specific DocType then try something

     <xsl:variable name="items" select="$currentPage/ancestor-or-self::* [@isDoc][@level = 2][not(umbracoNaviHide =1)][self::Textapges ]" />

    Hope this is what you are trying to achieve here.

    //fuji

  • Graeme W 113 posts 289 karma points
    Jan 27, 2014 @ 15:53
    Graeme W
    0

    Hi Adi There is another option if you are using Razor Views. The code below is pasted from the "Articles" template in the Standard Website Starter Kit (MVC version) and seems to work ok for me on v 6.

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
        Layout = "SW_Master.cshtml";
        int pageSize = 2; // How many items per page
        int page; // The page we are viewing
    
        /* Set up parameters */
    
        if (!int.TryParse(Request.QueryString["page"], out page))
        {
            page = 1;
        }
    
        /* This is your basic query to select the nodes you want */
    
        var nodes = Model.Content.Children.Where(x => x.DocumentTypeAlias == "NewsArticle").OrderBy(x=>x.CreateDate);
    
        int totalNodes = nodes.Count();
        int totalPages = (int)Math.Ceiling((double)totalNodes / (double)pageSize);
    
        /* Bounds checking */
    
        if (page > totalPages)
        {
            page = totalPages;
        }
        else if (page < 1)
        {
            page = 1;
        }
    
  • Adi 79 posts 183 karma points
    Jan 30, 2014 @ 22:10
    Adi
    0

    Hello Fuji,

    I don't think I explained it on the best way to you. Please see screenshot bellow:

    enter image description here

    Can you help me update this code

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet 
      version="1.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:msxml="urn:schemas-microsoft-com:xslt" 
      xmlns:umbraco.library="urn:umbraco.library"
      exclude-result-prefixes="msxml umbraco.library">
    
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    
    <xsl:param name="currentPage"/>
    
    <xsl:template match="/">
    
      <xsl:variable name="items" select="$currentPage/ancestor-or-self::* [@isDoc and @level = 2]/* [@isDoc and string(umbracoNaviHide) != '1']"/>
    
    <!-- The fun starts here -->
    
    <xsl:if test="count($items) &gt; 0">
    <ul>
    <xsl:for-each select="$items">
      <li>
        <a href="{umbraco.library:NiceUrl(@id)}">
          <xsl:value-of select="@nodeName"/>
        </a>
      </li>
    </xsl:for-each>
    </ul>
        </xsl:if>
    
    </xsl:template>
    
    </xsl:stylesheet>
    

    in order to have pagination , 10 articles per page?

    Thanks, Adi

  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 31, 2014 @ 06:17
    Fuji Kusaka
    0

    Hi Adi,

    By Active you mean be clickable from the list if so update this part and it should get you working.

    <ul>
     
    <xsl:for-eachselect="$about/*[@isDoc][not(umbracoNaviHide =1)]">
       
    <xsl:iftest="position() &lt; $jump and position() &gt;= ($jump - $itemsToDisplay)">
           
    <li><a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-ofselect="@nodeName"/></a></li>  
         
    </xsl:if>  
     
    </xsl:for-each>
    </ul>
  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 31, 2014 @ 06:30
    Fuji Kusaka
    0

    However if you want an active class on the current paging try this

    <xsl:templatename="for.loop">
                   
    <xsl:paramname="i"/>
                   
    <xsl:paramname="count"/>
                   
                   
    <xsl:iftest="$i &lt;=$count">
                           
    <xsl:iftest="$pageNumber!= $i">
                                   
    <ahref="?page={$i}#about"><xsl:value-ofselect="$i"/></a>
                           
    </xsl:if>

                           
    <xsl:iftest="$pageNumber = $i">
                             
    <a  class="selected"><xsl:value-ofselect="$i"/></a>// Here is the active current Page
                           
    </xsl:if>

                           
    <xsl:call-templatename="for.loop">
                                   
    <xsl:with-paramname="i"select="$i + 1"/>
                                   
    <xsl:with-paramname="count"select="$count">
                                   
    </xsl:with-param>
                           
    </xsl:call-template>
                   
    </xsl:if>
    </xsl:template>
  • Adi 79 posts 183 karma points
    Feb 01, 2014 @ 17:44
    Adi
    0

    Hi Graeme,

    thank you for posting very clean and useful Razlor example code but this time I decided to use XSLT.

    All the best, Adi

  • Adi 79 posts 183 karma points
    Feb 01, 2014 @ 18:28
    Adi
    0

    Hello Fuji,

    good news: code you suggestet is working successufully and now I have active links that are leading to articles.

    However, I am still facing the issue I have described earlier which is giving me troubles. Please note that this is the current code (#code1):

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet 
      version="1.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:umbraco.contour="urn:umbraco.contour" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch" 
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets umbraco.contour PS.XSLTsearch ">
    
    
    <xsl:output method="html" omit-xml-declaration="yes"/>
    
    <xsl:param name="currentPage"/>
    <xsl:variable name="about" select="umbraco.library:GetXmlNodeById('1303')"/><!-- Here is the NodeId from here you are pulling all the list of about -->
    
    
    <xsl:variable name="itemsToDisplay" select="10"/> <!-- Number of items to display per page -->
    <xsl:variable name="numberOfItems" select="count($about/*[@isDoc][not(umbracoNaviHide =1)])"/>
    <xsl:variable name="jump" select="$itemsToDisplay * $pageNumber" />
    
    
    
    <!-- Paging -->
    <xsl:variable name="pageNumber">
      <xsl:choose>
        <xsl:when test="umbraco.library:RequestQueryString('page') = ''">
          <xsl:value-of select="1"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="umbraco.library:RequestQueryString('page')"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>        
    
    <xsl:template match="/">
    <!-- start writing XSLT -->
      <ul>
      <xsl:for-each select="$about/*[@isDoc][not(umbracoNaviHide =1)]">
        <xsl:if test="position() &lt; $jump and position() &gt;= ($jump - $itemsToDisplay)">
           <!--<li><xsl:value-of select="@nodeName"/></li>-->
            <li><a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a></li>  
         </xsl:if>   
      </xsl:for-each>
    </ul>
    
    
      <xsl:call-template name="for.loop">
      <xsl:with-param name="i">1</xsl:with-param>
      <xsl:with-param name="count" select="ceiling($numberOfItems div $itemsToDisplay)"></xsl:with-param>
    </xsl:call-template>  
    
    
      </xsl:template>
    
        <xsl:template name="for.loop">
                    <xsl:param name="i"/>
                    <xsl:param name="count"/>
    
                    <xsl:if test="$i &lt;=$count">
                            <xsl:if test="$pageNumber!= $i">
                                    <a href="?page={$i}#about" ><xsl:value-of select="$i" /></a>
                            </xsl:if>
    
                            <xsl:if test="$pageNumber = $i">
                              <a  class="selected"><xsl:value-of select="$i"/></a>
                            </xsl:if>
    
                            <xsl:call-template name="for.loop">
                                    <xsl:with-param name="i" select="$i + 1" />
                                    <xsl:with-param name="count" select="$count">
                                    </xsl:with-param>
                            </xsl:call-template>
                    </xsl:if>
    </xsl:template>
    
    </xsl:stylesheet>
    

    and this is the part of #code1 which is giving me troubles

    umbraco.library:GetXmlNodeById('1303')
    

    On my template, I have this default example code (#code2)

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet 
      version="1.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:msxml="urn:schemas-microsoft-com:xslt" 
      xmlns:umbraco.library="urn:umbraco.library"
      exclude-result-prefixes="msxml umbraco.library">
    
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    
    <xsl:param name="currentPage"/>
    
    <xsl:template match="/">
    
      <xsl:variable name="items" select="$currentPage/ancestor-or-self::* [@isDoc and @level = 2]/* [@isDoc and string(umbracoNaviHide) != '1']"/>
    
    <!-- The fun starts here -->
    
    <xsl:if test="count($items) &gt; 0">
    <ul>
    <xsl:for-each select="$items">
      <li>
        <a href="{umbraco.library:NiceUrl(@id)}">
          <xsl:value-of select="@nodeName"/>
        </a>
      </li>
    </xsl:for-each>
    </ul>
        </xsl:if>
    
    </xsl:template>
    
    </xsl:stylesheet>
    

    which is showing list only if there is some content on current page. #code1 is showing only fixed value. Is it possible to update #code1 so it could show list only if there is some content on current page, same as it is defined on #code2?

    Greetings, Adi

  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 02, 2014 @ 06:47
    Fuji Kusaka
    0

    Hi Adi,

    So you want to display only the nodes where there is Content in it right ?

    You can modify the first code to this

    <xsl:for-eachselect="$about/*[@isDoc][not(umbracoNaviHide =1)][bodyContent !='']">
       
    <xsl:iftest="position() &lt; $jump and position() &gt;= ($jump - $itemsToDisplay)">
           
    <!--<li><xsl:value-of select="@nodeName"/></li>-->
           
    <li><ahref="{umbraco.library:NiceUrl(@id)}"><xsl:value-ofselect="@nodeName"/></a></li>  
         
    </xsl:if>  
     
    </xsl:for-each>
  • Adi 79 posts 183 karma points
    Feb 02, 2014 @ 09:46
    Adi
    0

    Hi Fuji,

    thank you very much for prompt reply.

    I did as you suggested:

    enter image description here

    but result is this

    enter image description here

    so now I can't see any items on the list?

    Greetings, Adi

  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 02, 2014 @ 12:21
    Fuji Kusaka
    0

    Hi Adi,

    Yes you wont see any items since this field is empty. In the example code i sent you before am using a bodyContent as umbraco field. 

    Have you tried adding something to this field in the back end ?

  • Adi 79 posts 183 karma points
    Feb 02, 2014 @ 17:09
    Adi
    0

    Hello Fuji,

    Ofcourse, I already have many articles which I have added long-time ago in back end. Your code is working great except that Pagination.xslt always pulls data only from one node '1303' and that is issue for me. Your code worked very good until I didn't modify this part

    <xsl:for-eachselect="$about/*[@isDoc][not(umbracoNaviHide =1)][bodyContent !='']">
        <xsl:iftest="position() &lt; $jump and position() &gt;= ($jump - $itemsToDisplay)">
           <!--<li><xsl:value-of select="@nodeName"/></li>-->
            <li><ahref="{umbraco.library:NiceUrl(@id)}"><xsl:value-ofselect="@nodeName"/></a></li>  
         </xsl:if>   
      </xsl:for-each>
    

    [#code2] works really good and it is showing list only if there is some data (it doesn't use fixed value '1303' as [#code1] which is good). That is biggest advantage of [#code2]

    [#code1] on the other side is showing only values from node '1303' which is not good and it is always shown on every page that uses Template 'Textpage'. For example, [#code2] also shows on every article that uses Template 'Textpage' but if there is no data, it doesn't shows anything which is great. Your code [#code1] has great advantages: it splits 10 articles per page, adds numeration of pages, creates links but it is only missing one more advantage that [#code2] has, which I describe above.

    I hope I exaplained it correctly, If I need to answer anything else please don't hasitate to tell me.

    Thank you, Adi

  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 02, 2014 @ 17:37
    Fuji Kusaka
    0

    Am getting a bite confused with [#code1][#code2]/!!!

    Anyways looks like code1 is working as you expected so this is one thing. Now you want to do the same thing with code 2 right? If so then it will be something like

    <xsl:variablename="items"select="$currentPage/ancestor-or-self::* [@isDoc and @level = 2]/* [@isDoc][not(umbracoNaviHide) != '1'][bodyContent !='']"/>

    <!-- The fun starts here -->

    <xsl:iftest="count($items) &gt; 0">
    <ul>
    <xsl:for-eachselect="$items">
     
    <li>
       
    <ahref="{umbraco.library:NiceUrl(@id)}">
         
    <xsl:value-ofselect="@nodeName"/>
       
    </a>
     
    </li>
    </xsl:for-each>
    </ul>
       
    </xsl:if>
  • Adi 79 posts 183 karma points
    Feb 02, 2014 @ 18:51
    Adi
    0

    Hello Fuji,

    I have also becomed confused with codes at the end;) but I had no way to describe the issue, this way via forum. I have link of my website which I would like to send you so you could see it live and difference between [#code1] and [#code2] because I simply have no way to explain it via forum. Please send me your e-mail or perhaps if I could send you pm via twitter or something like that.

    Thanks in advance.

    All the best, Adi

  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 03, 2014 @ 03:28
    Fuji Kusaka
    0

    Sure here is my twitter acc https://twitter.com/twit_fuji

  • Adi 79 posts 183 karma points
    Feb 03, 2014 @ 20:20
    Adi
    0

    Hi Fuji,

    this is my twitter acc @mcmdesign_de Can you please follow me so I could send you direct message? I am following your acc already.

    All the best, Adi

  • Adi 79 posts 183 karma points
    Feb 09, 2014 @ 21:43
    Adi
    0

    Thanks one more time Fuji!

    All the best, Adi

  • Adi 79 posts 183 karma points
    Feb 10, 2014 @ 09:49
    Adi
    0

    Hi,

    I am trying to mark this topic as solved and I don't know hot to do it;( Any suggestions?

    Thank you, Adi

  • Graeme W 113 posts 289 karma points
    Feb 10, 2014 @ 10:54
    Graeme W
    0

    Hi Adi. There should be a green tick at the top of each comment. Click on the one that you think best answers your question.

  • Adi 79 posts 183 karma points
    Feb 10, 2014 @ 20:27
    Adi
    0

    Thank you;)

    BR, Adi

Please Sign in or register to post replies

Write your reply to:

Draft