Copied to clipboard

Flag this post as spam?

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

  • Heather Floyd 607 posts 1008 karma points MVP 6x c-trib
    Aug 11, 2009 @ 21:27
    Heather Floyd

    Question: Accessing Events from Different Node

    Hi Peter,

    I'm enjoying your PDCalendar. I have a question, though.

    I see that the XSLTs work fine when they are used on a template on the content node which is the "parent" of all the events, but I was wondering how you would write XSLT to bring a small list of upcoming events onto a different page (for instance, the homepage).

    It seems that the dates/events data is brought in via this line of code:

    <xsl:variable name="messages" select="pdcalendar:GenerateDates($StartDate,$EndDate,'event')"/> 

    which doesn't allow specifying anything about the event nodes other than the name of the PDCalendar date property.

    How does pdcalendar:GenerateDates() work? Does it assume the current page is the parent of the events? Is there any way to pass in a different StartNode than the currentpage?



  • Peter Dijksterhuis 1442 posts 1722 karma points
    Aug 11, 2009 @ 21:41
    Peter Dijksterhuis

    Hi Heather,

    glad you like it :)

    The PDCalendar doesn't actually start from a startnode. The third parameter (in your code 'event') is the alias for a document-type. So, it looks through all your nodes that are that specific document-type. 

    I'm guessing that you want a second set of events right? Well, by the way it is designed now, just create a new document-type (just like your original one) and give it for example the alias 'event2'. You can then generate a second set of dates by calling pdcalendar:GenerateDates($StartDate,$EndDate,'event2')

    The calendar itself doesn't need to be on the 'parent' of all the events. You can display it on any page you want, since it doesn't look at childnodes, but to nodes that are a specific document-type.

    I don't know if you looked at the 3 xslt-files that come with the package, but the simplest one (PDCalendar.xslt) is the one you need I think. (The other 2 actually create a monthly calendar).

    Does this make sense to you or do I need to explain more or provide an example how to get events in the coming 2 weeks?


  • Heather Floyd 607 posts 1008 karma points MVP 6x c-trib
    Aug 11, 2009 @ 22:12
    Heather Floyd

    Oh, that's interesting. I thought that the third arguement was the name of the property - at least that is how I was using it...

    My setup:

    Name: Event
    Alias: Event
          Date Info (EventDateInfo), Type: PDCalendar
          Multi-Day Event (EventIsMultiDay), Type: True/false
          Time (EventTime), Type: Textstring
          Location (EventLocation), Type: Textstring
          To Register Info (EventRegistrationInfo), Type: Simple Editor
          Registration Button/Link Code (EventRegistrationCode), Type: Textbox multiple

    In XSLT I was using this:

    <xsl:variable name="messages" select="pdcalendar:GenerateDates($FirstDate,$LastDate,'EventDateInfo')" />

    Which always returns results... ('EventDateInfo' is the name of the PDCalendar Property)

    If I change it in my XSLT to:

    <xsl:variable name="messages" select="pdcalendar:GenerateDates($AllFirstDate,$AllLastDate,'Event')" />

    It now doesn't return anything...

    Although now I see that if I use my original code on a different page, it will return the "messages" XML. So I see that it will search the entire content tree for the events.

    In my particular case, I wasn't looking for a second separate list of events, but thanks for explaining that, since if I did wan another list, I wouldn't have realized that a separate DocType would be required.

    Thanks for your clarification!


    Ps. I've been doing some funky stuff with the calendar displays, if you'd like a copy of any of my XSLT... :-)

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Aug 11, 2009 @ 22:31
    Peter Dijksterhuis

    Oh's been too long since I worked on it (which reminds me to pick it up soon again to make further improvements!)

    You are absolutely right, sorry for the confusion. It looks for all nodes that has a property of the alias you specify. (In your case indeed EventDateInfo). In theory you can have multiple Document-types with the same property as long as it is of Data-type PDCalendar.

    Would a startnode-parameter come in handy for you? 

    I'd be interested in seeing some more live-examples how my data-type is being used, if you don't mind sharing the URL :)

    Again, sorry for the confusion I created!


  • Heather Floyd 607 posts 1008 karma points MVP 6x c-trib
    Aug 12, 2009 @ 02:59
    Heather Floyd

    Hi Peter,

    Well, I will be able to do what I need to, now that I know I can access the calendar data from anywhere. :-)

    Though it might be counter-intuitive that different calendars would need to have different Doctypes, to the general user, since it isn't a common convention in umbraco programing. In general when I create reusable macros, I tend to throw on a "Content Node (leave blank for current page)" parameter....

    Perhaps you could get an idea from others about whether they frequently have a need for multiple, separate calendars in a website? If not, it might not be necessary.

    Thanks again!


  • Robert J. Bullock 386 posts 405 karma points
    Jan 28, 2010 @ 16:40
    Robert J. Bullock

    Peter, a start node id would be VERY helpful to me as I want to be able to filter to events below a certain folder only.

  • Siw Ørnhaug 130 posts 109 karma points
    Sep 04, 2012 @ 13:56
    Siw Ørnhaug

    Hi, this thread was very helpfull indeed. I needed to make two custom calendars, one for internet (mainly courses for the public) and one for intranet (mainly internal meetings). It was very confusing when I thought the alias in the GenerateDates function was to be a document type. I made 2 doctypes with the same event data type and both showed every entry. Now I've made 2 different datatypes and it works well, wether I show the calendar or a list of upcoming events.

Please Sign in or register to post replies

Write your reply to: