Copied to clipboard

Flag this post as spam?

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


  • Sean 141 posts 179 karma points
    May 08, 2011 @ 12:43
    Sean
    0

    blog4umbraco - showing blog articles on other pages not happening

    Hi There,

    I was hoping that someone can help me get this to work on other pages outside the blog? I have added the macro into a template, however It's just not showing the ariticles.

    Thanks in advance

    Sean

     

    <?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:tagsLib="urn:tagsLib"
      xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
      xmlns:BlogLibrary="urn:BlogLibrary"
      exclude-result-prefixes="msxml umbraco.library tagsLib Exslt.ExsltStrings BlogLibrary">


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

      <xsl:param name="currentPage"/>
      <xsl:variable name="numberOfPosts" select="10"/>

      <xsl:variable name="pageNumber">
        <xsl:choose>
          <xsl:when test="umbraco.library:RequestQueryString('page') &lt;= 0 or string(umbraco.library:RequestQueryString('page')) = '' or string(umbraco.library:RequestQueryString('page')) = 'NaN'">1</xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="umbraco.library:RequestQueryString('page')"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>

      <xsl:variable name="filter">
        <xsl:choose>
          <xsl:when test="string-length(umbraco.library:Request('filterby')) &gt; 0">
            <xsl:value-of select="umbraco.library:Request('filterby')"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="''"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>

      <xsl:variable name="numberOfRecords">
        <xsl:choose>
          <xsl:when test="$filter = ''">
            <xsl:value-of select="count($currentPage/ancestor-or-self::Blog//BlogPost)"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="count($currentPage/ancestor-or-self::Blog//BlogPost [contains(Exslt.ExsltStrings:lowercase(./tags), Exslt.ExsltStrings:lowercase($filter))])"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>

      <xsl:template match="/">


        <xsl:if test="$filter != ''">
          <h2 class="page-title">
            Archive for tag:
            <span>
              <xsl:value-of select="$filter"/>
            </span>
          </h2>
        </xsl:if>
        
        <xsl:if test="$currentPage/@nodeTypeAlias = 'DateFolder'">
          <h2 class="page-title">
            Monthly Archives: <xsl:value-of select="umbraco.library:FormatDateTime(concat($currentPage/../@nodeName,'-',$currentPage/@nodeName,'-11T10:24:46'),'MMMM yyyy')"/>
          </h2>
        </xsl:if>

        <xsl:if test="$numberOfRecords &gt; $numberOfPosts">
        <div id="nav-above" class="navigation">

          <div class="nav-previous">
            <xsl:if test="(($pageNumber ) * $numberOfPosts) &lt; ($numberOfRecords)">
              <span class="meta-nav">&#171; </span>
              <a href="?page={$pageNumber +1}">Older posts</a>
            </xsl:if>
          </div>

          <div class="nav-next">
            <xsl:if test="$pageNumber &gt; 1">
              <a href="?page={$pageNumber -1}">Newer posts</a>
              <span class="meta-nav"> &#187;</span>
            </xsl:if>
          </div>

        </div>
        </xsl:if>
        
        <xsl:if test="$filter = ''">

          
          <xsl:for-each select="$currentPage/ancestor-or-self::Blog//BlogPost">
            <xsl:sort select="./PostDate" order="descending" />

            <xsl:if test="position() &gt; $numberOfPosts * (number($pageNumber)-1) and
            position() &lt;= number($numberOfPosts * (number($pageNumber)-1) +
            $numberOfPosts )">
              
              <xsl:call-template name="showpost">
                <xsl:with-param name="post" select="."/>
              </xsl:call-template>
          
            </xsl:if>
            
           </xsl:for-each>
        </xsl:if>

        <xsl:if test="$filter != ''">

          <xsl:for-each select="$currentPage/ancestor-or-self::Blog//BlogPost [contains(Exslt.ExsltStrings:lowercase(./tags), Exslt.ExsltStrings:lowercase($filter))]">
            <xsl:sort select="./PostDate" order="descending" />
            <xsl:if test="position() &gt; $numberOfPosts * (number($pageNumber)-1) and
            position() &lt;= number($numberOfPosts * (number($pageNumber)-1) +
            $numberOfPosts )">
              <xsl:call-template name="showpost">
                <xsl:with-param name="post" select="."/>
              </xsl:call-template>
            </xsl:if>
          </xsl:for-each>
        </xsl:if>

        <div id="nav-below" class="navigation">

          <div class="nav-previous">
            <xsl:if test="(($pageNumber ) * $numberOfPosts) &lt; ($numberOfRecords)">
              <span class="meta-nav">&#171; </span>
              <a href="?page={$pageNumber +1}">Older posts</a>
            </xsl:if>
          </div>

          <div class="nav-next">
            <xsl:if test="$pageNumber &gt; 1">
              <a href="?page={$pageNumber -1}">Newer posts</a>
              <span class="meta-nav"> &#187;</span>
            </xsl:if>
          </div>

        </div>


      </xsl:template>

      <xsl:template name="showpost">
        <xsl:param name="post"/>

        <div class="hentry post publish author-{$post/@writername} tag-boat tag-lake {umbraco.library:FormatDateTime($post/@updateDate, 'yYYYY mMM')} y2008 m10 d17 h04">
          <h2 class="entry-title" id="post-{$post/@id}">
            <a href="{umbraco.library:NiceUrl($post/@id)}" title="Permalink to {$post/@nodeName}">
              <xsl:value-of select="$post/@nodeName"/>
            </a>
          </h2>

          <div class="entry-date">
            <abbr class="published" title="umbraco.library:ShortDate($post/PostDate">
              <xsl:value-of select="umbraco.library:LongDate($post/PostDate)"/>
            </abbr>
          </div>


          <div class="entry-content">
            <xsl:value-of select="$post/bodyText" disable-output-escaping="yes"/>
          </div>

          <div class="entry-meta">

            <span class="author vcard">
              By: <span class="fn n">
                <xsl:value-of select="$post/@creatorName"/>
              </span>
            </span>
            <span class="meta-sep"> |</span>
            <span class="tag-links">
              <xsl:variable name="tags" select="tagsLib:getTagsFromNode(@id)" />
              <xsl:choose>
                <xsl:when test="count($tags/tags/tag) = 0">
                  Not tagged
                </xsl:when>
                <xsl:otherwise>
                  Tagged:
                  <xsl:for-each select="$tags/tags/tag">
                    <a href="{umbraco.library:NiceUrl($currentPage/ancestor-or-self::Blog/@id)}?filterby={.}" rel="tag">
                      <xsl:value-of select="."/>
                    </a>
                    <xsl:if test="position() != last()">, </xsl:if>
                  </xsl:for-each>
                </xsl:otherwise>
              </xsl:choose>
            </span>
            <span class="meta-sep"> | </span>
            <xsl:variable name="numberofcomments" select="count(BlogLibrary:GetCommentsForPost($post/@id)//comment)"/>
            <span class="comments-link">
              <xsl:choose>
                <xsl:when test="$numberofcomments = 0">
                  <xsl:choose>
                    <xsl:when test="string($post/data [@alias = 'closeComments']) = '1'">
                      Comments closed
                    </xsl:when>
                    <xsl:otherwise>
                      <a href="{umbraco.library:NiceUrl(@id)}#comments">Leave comment</a>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:when>
                <xsl:when test="$numberofcomments = 1">
                  <a href="{umbraco.library:NiceUrl(@id)}#comments">1 comment</a>
                </xsl:when>
                <xsl:otherwise>
                  <a href="{umbraco.library:NiceUrl(@id)}#comments">
                    <xsl:value-of select="$numberofcomments"/> comments
                  </a>
                </xsl:otherwise>
              </xsl:choose>
            </span>
          </div>

        </div>
      </xsl:template>
    </xsl:stylesheet>

  • Søren Tidmand 129 posts 366 karma points
    May 08, 2011 @ 15:21
    Søren Tidmand
    0

    Hi Sean,

    If you take a look at the for-each you'll see that it only searches for blog posts "within" the Blog section, so if the current page is outside you will not get any result:

    <xsl:for-each select="$currentPage/ancestor-or-self::Blog//BlogPost">

    If you're macro is placed outside the Blog pages you'll have to go one step further in the node tree and look for the start of the Blog section. I'd suggest that you make a parameter on the macro (alias=source / Name=Get Blog section / Type: contentPicker). This will pass on the ID of the Blog section. Then change the <for-each>-selections from $currentPage to $source in your xslt like this:

    <xsl:param name="currentPage"/>
    <!-- set the source -->
    <xsl:variable name="source" select="//macro/source" />

    ------ FURHTER DOWN IN THE CODE ----------

    <xsl:for-each select="umbraco.library:GetXmlNodeById($source)//BlogPost">

    Remember there are two <for-each>-selections in your code. Do not change anything in the <xsl:for-each select="$tags/tags/tag">.

    This should do the trick.

    Best regard,
    Søren

  • Sean 141 posts 179 karma points
    May 09, 2011 @ 05:26
    Sean
    0

    Hi Soren,

    Thanks for the reply. I have made the changes that you suggested, however it's not returning a result. I made the following:

    • modifed the macro and added the source paramter in using the macro editor.
    • add the variable, changed the for loop to include the new variable (all marked in bold)
    • added the following into the template      
                          <umbraco:Macro source="1078" Alias="BlogListPosts" runat="server"></umbraco:Macro>
    •      
         

    I'm sure that I've missed something trivial. Are you able to take a look for me 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:tagsLib="urn:tagsLib"
      xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
      xmlns:BlogLibrary="urn:BlogLibrary"
      exclude-result-prefixes="msxml umbraco.library tagsLib Exslt.ExsltStrings BlogLibrary">


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

      <xsl:param name="currentPage"/>
      <xsl:variable name="numberOfPosts" select="10"/>
      <xsl:variable name="source" select="//macro/source" />

      <xsl:variable name="pageNumber">
        <xsl:choose>
          <xsl:when test="umbraco.library:RequestQueryString('page') &lt;= 0 or string(umbraco.library:RequestQueryString('page')) = '' or string(umbraco.library:RequestQueryString('page')) = 'NaN'">1</xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="umbraco.library:RequestQueryString('page')"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>

      <xsl:variable name="filter">
        <xsl:choose>
          <xsl:when test="string-length(umbraco.library:Request('filterby')) &gt; 0">
            <xsl:value-of select="umbraco.library:Request('filterby')"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="''"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>

      <xsl:variable name="numberOfRecords">
        <xsl:choose>
          <xsl:when test="$filter = ''">
            <xsl:value-of select="count($currentPage/ancestor-or-self::Blog//BlogPost)"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="count($currentPage/ancestor-or-self::Blog//BlogPost [contains(Exslt.ExsltStrings:lowercase(./tags), Exslt.ExsltStrings:lowercase($filter))])"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>

      <xsl:template match="/">


        <xsl:if test="$filter != ''">
          <h2 class="page-title">
            Archive for tag:
            <span>
              <xsl:value-of select="$filter"/>
            </span>
          </h2>
        </xsl:if>
        
        <xsl:if test="$currentPage/@nodeTypeAlias = 'DateFolder'">
          <h2 class="page-title">
            Monthly Archives: <xsl:value-of select="umbraco.library:FormatDateTime(concat($currentPage/../@nodeName,'-',$currentPage/@nodeName,'-11T10:24:46'),'MMMM yyyy')"/>
          </h2>
        </xsl:if>

        <xsl:if test="$numberOfRecords &gt; $numberOfPosts">
        <div id="nav-above" class="navigation">

          <div class="nav-previous">
            <xsl:if test="(($pageNumber ) * $numberOfPosts) &lt; ($numberOfRecords)">
              <span class="meta-nav">&#171; </span>
              <a href="?page={$pageNumber +1}">Older posts</a>
            </xsl:if>
          </div>

          <div class="nav-next">
            <xsl:if test="$pageNumber &gt; 1">
              <a href="?page={$pageNumber -1}">Newer posts</a>
              <span class="meta-nav"> &#187;</span>
            </xsl:if>
          </div>

        </div>
        </xsl:if>
        
        <xsl:if test="$filter = ''">
          
           <xsl:for-each select="umbraco.library:GetXmlNodeById($source)//BlogPost">

          
          <!-- <xsl:for-each select="$currentPage/ancestor-or-self::Blog//BlogPost">-->
            <xsl:sort select="./PostDate" order="descending" />

            <xsl:if test="position() &gt; $numberOfPosts * (number($pageNumber)-1) and
            position() &lt;= number($numberOfPosts * (number($pageNumber)-1) +
            $numberOfPosts )">
              
              <xsl:call-template name="showpost">
                <xsl:with-param name="post" select="."/>
              </xsl:call-template>
          
            </xsl:if>
            
           </xsl:for-each>
        </xsl:if>

        <xsl:if test="$filter != ''">

          <xsl:for-each select="$currentPage/ancestor-or-self::Blog//BlogPost [contains(Exslt.ExsltStrings:lowercase(./tags), Exslt.ExsltStrings:lowercase($filter))]">
            <xsl:sort select="./PostDate" order="descending" />
            <xsl:if test="position() &gt; $numberOfPosts * (number($pageNumber)-1) and
            position() &lt;= number($numberOfPosts * (number($pageNumber)-1) +
            $numberOfPosts )">
              <xsl:call-template name="showpost">
                <xsl:with-param name="post" select="."/>
              </xsl:call-template>
            </xsl:if>
          </xsl:for-each>
        </xsl:if>

        <div id="nav-below" class="navigation">

          <div class="nav-previous">
            <xsl:if test="(($pageNumber ) * $numberOfPosts) &lt; ($numberOfRecords)">
              <span class="meta-nav">&#171; </span>
              <a href="?page={$pageNumber +1}">Older posts</a>
            </xsl:if>
          </div>

          <div class="nav-next">
            <xsl:if test="$pageNumber &gt; 1">
              <a href="?page={$pageNumber -1}">Newer posts</a>
              <span class="meta-nav"> &#187;</span>
            </xsl:if>
          </div>

        </div>


      </xsl:template>

      <xsl:template name="showpost">
        <xsl:param name="post"/>

        <div class="hentry post publish author-{$post/@writername} tag-boat tag-lake {umbraco.library:FormatDateTime($post/@updateDate, 'yYYYY mMM')} y2008 m10 d17 h04">
          <h2 class="entry-title" id="post-{$post/@id}">
            <a href="{umbraco.library:NiceUrl($post/@id)}" title="Permalink to {$post/@nodeName}">
              <xsl:value-of select="$post/@nodeName"/>
            </a>
          </h2>

          <div class="entry-date">
            <abbr class="published" title="umbraco.library:ShortDate($post/PostDate">
              <xsl:value-of select="umbraco.library:LongDate($post/PostDate)"/>
            </abbr>
          </div>


          <div class="entry-content">
            <xsl:value-of select="$post/bodyText" disable-output-escaping="yes"/>
          </div>

          <div class="entry-meta">

            <span class="author vcard">
              By: <span class="fn n">
                <xsl:value-of select="$post/@creatorName"/>
              </span>
            </span>
            <span class="meta-sep"> |</span>
            <span class="tag-links">
              <xsl:variable name="tags" select="tagsLib:getTagsFromNode(@id)" />
              <xsl:choose>
                <xsl:when test="count($tags/tags/tag) = 0">
                  Not tagged
                </xsl:when>
                <xsl:otherwise>
                  Tagged:
                  <xsl:for-each select="$tags/tags/tag">
                    <a href="{umbraco.library:NiceUrl($currentPage/ancestor-or-self::Blog/@id)}?filterby={.}" rel="tag">
                      <xsl:value-of select="."/>
                    </a>
                    <xsl:if test="position() != last()">, </xsl:if>
                  </xsl:for-each>
                </xsl:otherwise>
              </xsl:choose>
            </span>
            <span class="meta-sep"> | </span>
            <xsl:variable name="numberofcomments" select="count(BlogLibrary:GetCommentsForPost($post/@id)//comment)"/>
            <span class="comments-link">
              <xsl:choose>
                <xsl:when test="$numberofcomments = 0">
                  <xsl:choose>
                    <xsl:when test="string($post/data [@alias = 'closeComments']) = '1'">
                      Comments closed
                    </xsl:when>
                    <xsl:otherwise>
                      <a href="{umbraco.library:NiceUrl(@id)}#comments">Leave comment</a>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:when>
                <xsl:when test="$numberofcomments = 1">
                  <a href="{umbraco.library:NiceUrl(@id)}#comments">1 comment</a>
                </xsl:when>
                <xsl:otherwise>
                  <a href="{umbraco.library:NiceUrl(@id)}#comments">
                    <xsl:value-of select="$numberofcomments"/> comments
                  </a>
                </xsl:otherwise>
              </xsl:choose>
            </span>
          </div>

        </div>
      </xsl:template>
    </xsl:stylesheet>

  • Sean 141 posts 179 karma points
    May 09, 2011 @ 23:32
    Sean
    0

    Hi Soren,

    Any ideas on this?

  • Søren Tidmand 129 posts 366 karma points
    May 09, 2011 @ 23:43
    Søren Tidmand
    0

    Hi Sean,

    It might be easier for me to see what is missing if I could get access to your Umbraco-installation. Send me credentials on ***** and I'll look into it right away.

     

  • Sean 141 posts 179 karma points
    May 10, 2011 @ 00:59
    Sean
    0

    Hi Soren, I'm a little reluctant to give credentials the system. Can I give you screen shots instead or snippets ?

  • Søren Tidmand 129 posts 366 karma points
    May 10, 2011 @ 01:19
    Søren Tidmand
    0

    No worries. It's probably just a minor detail that's missing. Try to print out the xml of the source in a textbox by inserting the following code above the <if>-statement:

    <textarea>
    <xsl:copy-of select="umbraco.library:GetXmlNodeById($source)//BlogPost" />
    <xsl:text> </xsl:text>
    </textarea>

    <
    xsl:if test="$filter = ''">
          .......
    </xsl:if>

    Save the xslt and have a look on the live page to see whether it gives you any output.

    You might also need to update the variable "numberOfRecords":

    <xsl:variable name="numberOfRecords">
        <xsl:choose>
          <xsl:when test="$filter = ''">
            <xsl:value-of select="count(umbraco.library:GetXmlNodeById($source)//BlogPost)"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="count(umbraco.library:GetXmlNodeById($source)//BlogPost [contains(Exslt.ExsltStrings:lowercase(./tags), Exslt.ExsltStrings:lowercase($filter))])"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>

    Søren

  • Sean 141 posts 179 karma points
    May 10, 2011 @ 11:34
    Sean
    0

    Hi Soren,

    I made the changes but when I even visualise the output it comes up with an empty text area. Any other ideas?

     

    <?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:tagsLib="urn:tagsLib"
      xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
      xmlns:BlogLibrary="urn:BlogLibrary"
      exclude-result-prefixes="msxml umbraco.library tagsLib Exslt.ExsltStrings BlogLibrary">


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

      <xsl:param name="currentPage"/>
      <xsl:variable name="numberOfPosts" select="10"/>
      <xsl:variable name="source" select="//macro/source" />

      <xsl:variable name="pageNumber">
        <xsl:choose>
          <xsl:when test="umbraco.library:RequestQueryString('page') &lt;= 0 or string(umbraco.library:RequestQueryString('page')) = '' or string(umbraco.library:RequestQueryString('page')) = 'NaN'">1</xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="umbraco.library:RequestQueryString('page')"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>

      <xsl:variable name="filter">
        <xsl:choose>
          <xsl:when test="string-length(umbraco.library:Request('filterby')) &gt; 0">
            <xsl:value-of select="umbraco.library:Request('filterby')"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="''"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>

      <xsl:variable name="numberOfRecords">
        <xsl:choose>
          <xsl:when test="$filter = ''">
            <xsl:value-of select="count($currentPage/ancestor-or-self::Blog//BlogPost)"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="count($currentPage/ancestor-or-self::Blog//BlogPost [contains(Exslt.ExsltStrings:lowercase(./tags), Exslt.ExsltStrings:lowercase($filter))])"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>

      <xsl:template match="/">


        <xsl:if test="$filter != ''">
          <h2 class="page-title">
            Archive for tag:
            <span>
              <xsl:value-of select="$filter"/>
            </span>
          </h2>
        </xsl:if>
       
        <xsl:if test="$currentPage/@nodeTypeAlias = 'DateFolder'">
          <h2 class="page-title">
            Monthly Archives: <xsl:value-of select="umbraco.library:FormatDateTime(concat($currentPage/../@nodeName,'-',$currentPage/@nodeName,'-11T10:24:46'),'MMMM yyyy')"/>
          </h2>
        </xsl:if>

        <xsl:if test="$numberOfRecords &gt; $numberOfPosts">
        <div id="nav-above" class="navigation">

          <div class="nav-previous">
            <xsl:if test="(($pageNumber ) * $numberOfPosts) &lt; ($numberOfRecords)">
              <span class="meta-nav">&#171; </span>
              <a href="?page={$pageNumber +1}">Older posts</a>
            </xsl:if>
          </div>

          <div class="nav-next">
            <xsl:if test="$pageNumber &gt; 1">
              <a href="?page={$pageNumber -1}">Newer posts</a>
              <span class="meta-nav"> &#187;</span>
            </xsl:if>
          </div>

        </div>
        </xsl:if>
       
        <xsl:if test="$filter = ''">
         
           <xsl:for-each select="umbraco.library:GetXmlNodeById($source)//BlogPost">

         
          <!-- <xsl:for-each select="$currentPage/ancestor-or-self::Blog//BlogPost">-->
            <xsl:sort select="./PostDate" order="descending" />

            <xsl:if test="position() &gt; $numberOfPosts * (number($pageNumber)-1) and
            position() &lt;= number($numberOfPosts * (number($pageNumber)-1) +
            $numberOfPosts )">
             
              <xsl:call-template name="showpost">
                <xsl:with-param name="post" select="."/>
              </xsl:call-template>
         
            </xsl:if>
           
           </xsl:for-each>
        </xsl:if>

        <xsl:if test="$filter != ''">

          <xsl:for-each select="$currentPage/ancestor-or-self::Blog//BlogPost [contains(Exslt.ExsltStrings:lowercase(./tags), Exslt.ExsltStrings:lowercase($filter))]">
            <xsl:sort select="./PostDate" order="descending" />
            <xsl:if test="position() &gt; $numberOfPosts * (number($pageNumber)-1) and
            position() &lt;= number($numberOfPosts * (number($pageNumber)-1) +
            $numberOfPosts )">
              <xsl:call-template name="showpost">
                <xsl:with-param name="post" select="."/>
              </xsl:call-template>
            </xsl:if>
          </xsl:for-each>
        </xsl:if>

        <div id="nav-below" class="navigation">

          <div class="nav-previous">
            <xsl:if test="(($pageNumber ) * $numberOfPosts) &lt; ($numberOfRecords)">
              <span class="meta-nav">&#171; </span>
              <a href="?page={$pageNumber +1}">Older posts</a>
            </xsl:if>
          </div>

          <div class="nav-next">
            <xsl:if test="$pageNumber &gt; 1">
              <a href="?page={$pageNumber -1}">Newer posts</a>
              <span class="meta-nav"> &#187;</span>
            </xsl:if>
          </div>

        </div>


      </xsl:template>

      <xsl:template name="showpost">
        <xsl:param name="post"/>

        <div class="hentry post publish author-{$post/@writername} tag-boat tag-lake {umbraco.library:FormatDateTime($post/@updateDate, 'yYYYY mMM')} y2008 m10 d17 h04">
          <h2 class="entry-title" id="post-{$post/@id}">
            <a href="{umbraco.library:NiceUrl($post/@id)}" title="Permalink to {$post/@nodeName}">
              <xsl:value-of select="$post/@nodeName"/>
            </a>
          </h2>

          <div class="entry-date">
            <abbr class="published" title="umbraco.library:ShortDate($post/PostDate">
              <xsl:value-of select="umbraco.library:LongDate($post/PostDate)"/>
            </abbr>
          </div>


          <div class="entry-content">
            <xsl:value-of select="$post/bodyText" disable-output-escaping="yes"/>
          </div>

          <div class="entry-meta">

            <span class="author vcard">
              By: <span class="fn n">
                <xsl:value-of select="$post/@creatorName"/>
              </span>
            </span>
            <span class="meta-sep"> |</span>
            <span class="tag-links">
              <xsl:variable name="tags" select="tagsLib:getTagsFromNode(@id)" />
              <xsl:choose>
                <xsl:when test="count($tags/tags/tag) = 0">
                  Not tagged
                </xsl:when>
                <xsl:otherwise>
                  Tagged:
                  <xsl:for-each select="$tags/tags/tag">
                    <a href="{umbraco.library:NiceUrl($currentPage/ancestor-or-self::Blog/@id)}?filterby={.}" rel="tag">
                      <xsl:value-of select="."/>
                    </a>
                    <xsl:if test="position() != last()">, </xsl:if>
                  </xsl:for-each>
                </xsl:otherwise>
              </xsl:choose>
            </span>
            <span class="meta-sep"> | </span>
            <xsl:variable name="numberofcomments" select="count(BlogLibrary:GetCommentsForPost($post/@id)//comment)"/>
            <span class="comments-link">
              <xsl:choose>
                <xsl:when test="$numberofcomments = 0">
                  <xsl:choose>
                    <xsl:when test="string($post/data [@alias = 'closeComments']) = '1'">
                      Comments closed
                    </xsl:when>
                    <xsl:otherwise>
                      <a href="{umbraco.library:NiceUrl(@id)}#comments">Leave comment</a>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:when>
                <xsl:when test="$numberofcomments = 1">
                  <a href="{umbraco.library:NiceUrl(@id)}#comments">1 comment</a>
                </xsl:when>
                <xsl:otherwise>
                  <a href="{umbraco.library:NiceUrl(@id)}#comments">
                    <xsl:value-of select="$numberofcomments"/> comments
                  </a>
                </xsl:otherwise>
              </xsl:choose>
            </span>
          </div>

        </div>
      </xsl:template>
    </xsl:stylesheet>

  • Søren Tidmand 129 posts 366 karma points
    May 10, 2011 @ 12:22
    Søren Tidmand
    0

    Hi Sean,

    I must admit that I am more of a "see and feel" kind of coder, so I can't solve this issue at this point without being able to dive in and try out some adjustments my self.

    I hope you'll get some help from others.

    Cheers,
    Søren

  • Sean 141 posts 179 karma points
    May 11, 2011 @ 02:32
    Sean
    0

    No problem Soren. I appreciate the help. I'm unable to give you access a production system, sorry. I'll sort something out. Sean

Please Sign in or register to post replies

Write your reply to:

Draft