Copied to clipboard

Flag this post as spam?

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


  • Tony 13 posts 43 karma points
    Feb 08, 2011 @ 18:26
    Tony
    0

    How to find what page I'm on?

    I've just started using Umbraco this week and creating a little site as a demo. What I need to do is count the number of pages are in each section and what page I'm on... so it looks like.... 1/10 (page 1 of ten) Got it displaying the total number of pages but can't get it to show what page I'm currently on... here's my code so far...thanks in advance.

    <?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"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">

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

    <xsl:param name="currentPage"/>

    <!-- Input the documenttype you want here -->
    <xsl:variable name="level" select="1"/>
    <xsl:variable name="nextId" select="number($currentPage/following-sibling::* [@isDoc][1]/@id)"/>
    <xsl:variable name="prevId" select="number($currentPage/preceding-sibling::* [@isDoc][1]/@id)"/>

    <xsl:template match="/">

    <!-- The fun starts here -->
    <ul>
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
      <li>
        <a href="{umbraco.library:NiceUrl(@id)}" class="fade">
          <xsl:value-of select="@nodeName"/>
        </a>
      <xsl:if test="$currentPage/ancestor-or-self::*[@id = current()/@id]">
    <span class="sublink">
        <xsl:if test="$prevId &gt; 0"><a href="{umbraco.library:NiceUrl($prevId)}"><img src="/images/but-left.gif" border="0" /></a>  
      </xsl:if>
        <xsl:if test="$nextId &gt; 0"><a href="{umbraco.library:NiceUrl($nextId)}"><img src="/images/but-right.gif" border="0" /></a>
          <otherwise/>
          
      </xsl:if>
     <!--HELP NEEDED HERE-->/<xsl:value-of select="count($currentPage/ancestor-or-self::* [@level=2]/* [@isDoc and string(umbracoNaviHide) != '2'])" />
     
        </span>
        </xsl:if>

      </li>
    </xsl:for-each>
    </ul>

    </xsl:template>

    </xsl:stylesheet>
Please Sign in or register to post replies

Write your reply to:

Draft