What data for the shop location do you have available in Umbraco? Are you tagging the news by location using either the tag datatype or simply a checkbox? Or are you thinking of using longitude and latitude for instance to show news relevant to where the user is right now?
News Item Associated with location
Hi,
Im using the umbraco.tv news area, news item tutorial.
I have a site that has a general news area, but i would like to filter and show only relevent news articles based on shop location.
Im still new to XSLT, so any help would be grateful
my xslt for my news item is
And my News Area is
<xsl:param name="currentPage"/>
<xsl:variable name="itemsPerPage" select="5"/>
<xsl:variable name="numberOfItems" select="count($currentPage/* [@isDoc and string(umbracoNaviHide) != '1'])"/>
<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>
<!-- day -->
<xsl:variable name="newsDay">
<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="/">
<!-- The fun starts here -->
<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
<xsl:sort select="@createDate" order="descending"/>
<xsl:if test="position() > $itemsPerPage * number($pageNumber -1) and
position() <= number($itemsPerPage * number($pageNumber -1) + $itemsPerPage)">
<div class="twelve columns alpha clearfix">
<h3 class="newsHeadline col">
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</h3>
<xsl:value-of select="umbraco.library:LongDate(@createDate)"/>
<p><xsl:value-of select="newsSummary" disable-output-escaping="yes"/></p>
</div>
</xsl:if>
</xsl:for-each>
<div class="twelve columns alpha paginator clearfix">
<!-- PAGE NUMBERS -->
<xsl:if test="$pageNumber > 1">
<div class="one column" style="text-align:center;">
<a class="prev" href="?page={$pageNumber -1}">Prev</a>
</div>
</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 $itemsPerPage)"></xsl:with-param>
</xsl:call-template>
<!-- NEXT BUTTON-->
<xsl:if test="(($pageNumber) * $itemsPerPage) < ($numberOfItems)">
<div class="one column" style="text-align:center;">
<a class="next" href="?page={$pageNumber +1}">Next</a>
</div>
</xsl:if>
</div>
</xsl:template>
<xsl:template name="for.loop">
<xsl:param name="i"/>
<xsl:param name="count"/>
<xsl:if test="$i <= $count">
<xsl:if test="$pageNumber != $i">
<div class="one column" style="text-align:center;">
<a class="page" href="?page={$i}">
<xsl:value-of select="$i" />
</a></div>
</xsl:if>
<xsl:if test="$pageNumber = $i ">
<div class="one column" style="text-align:center;">
<span> <xsl:value-of select="$i" /></span>
</div>
</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>
Hi Martin
What data for the shop location do you have available in Umbraco? Are you tagging the news by location using either the tag datatype or simply a checkbox? Or are you thinking of using longitude and latitude for instance to show news relevant to where the user is right now?
/Jan
is working on a reply...