I have the following code to display the site services in the footer area but my "view all" link only works when in the services home page...on any other page there is no link...all i want is the view all link to link to the services home page no matter what page you are on.
I'm assuming that it is the "esiServices" node you want to link to? Currently you're linking to the current page's parent, so that's why it only works when you are on a specific service page. This should do it:
It finds the nearest ancestor node (or the page itself) that has an esiServices child, and creates the link based on that child's @id attribute. If the parent page has a specific nodetype, you can improve performance by searching for that directly, e.g.:
System.OverflowException: Value was either too large or too small for an Int32. at System.Convert.ToInt32(Double value) at System.Double.System.IConvertible.ToInt32(IFormatProvider provider)
However i have just tired i again and check the box to ingore errors and it works, thanks again...
Link only working in certain sections
I have the following code to display the site services in the footer area but my "view all" link only works when in the services home page...on any other page there is no link...all i want is the view all link to link to the services home page no matter what page you are on.
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="noOfItems" select="6" />
<xsl:param name="MaxNoChars" select="100" />
<xsl:template match="/">
<div class="services">
<h3>Our Services</h3>
<xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc]/esiServices/* [@isDoc]">
<xsl:sort select="@createDate" order="ascending"/>
<!-- Position() <= $noOfItems -->
<xsl:if test="position()<= $noOfItems">
<!-- TODO: strip HTML & truncate -->
<h4><a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName" /></a></h4>
</xsl:if>
</xsl:for-each>
<p>[ <a href="{umbraco.library:NiceUrl($currentPage/@parentID)}"> View all </a> ]</p>
<br class="clearfloat" />
</div>
</xsl:template>
I'm assuming that it is the "esiServices" node you want to link to? Currently you're linking to the current page's parent, so that's why it only works when you are on a specific service page. This should do it:
It finds the nearest ancestor node (or the page itself) that has an esiServices child, and creates the link based on that child's @id attribute. If the parent page has a specific nodetype, you can improve performance by searching for that directly, e.g.:
thanks Dan, I had tried that but got an error...
Error occured
System.OverflowException: Value was either too large or too small for an Int32.
at System.Convert.ToInt32(Double value)
at System.Double.System.IConvertible.ToInt32(IFormatProvider provider)
However i have just tired i again and check the box to ingore errors and it works, thanks again...
S
is working on a reply...