i am using a blog type senario for events ie date folders, each event has a date property which is used to hide the article after the date has past, however i have 4 different areas within the site to add events one for each section of our Scout group, is there a way i can show the next event only on the front page of my website?
In XSLT you do that by selecting all the future events, attempting to run through them sorted ascending by date and then taking the first:
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:umb="urn:umbraco.library"
exclude-result-prefixes="umb"
>
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<xsl:param name="currentPage" />
<xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[@level = 1]" />
<xsl:variable name="eventsRoot" select="$siteRoot/Events" /><!-- Change this to grab the top node for all events -->
<xsl:variable name="futureEvents" select="$eventsRoot//Event[umb:DateGreaterThanOrEqualToday(eventDate)]" />
<xsl:template match="/">
<xsl:for-each select="$futureEvents">
<xsl:sort select="eventDate" data-type="text" order="ascending" />
<xsl:if test="position() = 1">
<xsl:apply-templates select="." />
</xsl:if>
</xsl:for-each>
</xsl:template>
<!-- Template for Events... -->
<xsl:template match="Event">
<div class="nextevent">
<xsl:value-of select="@nodeName" />
<!-- etc. -->
</div>
</xsl:template>
</xsl:stylesheet>
You need to change the stuff highlighted - basically the nodeTypeAlias of your event document type (Event) and the property alias of the date property (eventDate)
latest article by date
i am using a blog type senario for events ie date folders, each event has a date property which is used to hide the article after the date has past, however i have 4 different areas within the site to add events one for each section of our Scout group, is there a way i can show the next event only on the front page of my website?
Explorer events
2012
08
event1
event2
09
event3
event4
event5
event6
assuming that the dates for events 1 to 3 has passed i would like to show only event 4 on the home page
thanks
G
Hi Grant,
In XSLT you do that by selecting all the future events, attempting to run through them sorted ascending by date and then taking the first:
You need to change the stuff highlighted - basically the nodeTypeAlias of your event document type (Event) and the property alias of the date property (eventDate)
/Chriztian
is working on a reply...