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:
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?
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?
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!
Heather
Ps. I've been doing some funky stuff with the calendar displays, if you'd like a copy of any of my XSLT... :-)
Oh right.....it'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 :)
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.
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.
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:
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?
Thanks!
Heather
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?
Peter
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:
DocumentType:
Name: Event
Alias: Event
Properties:
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:
Which always returns results... ('EventDateInfo' is the name of the PDCalendar Property)
If I change it in my XSLT to:
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!
Heather
Ps. I've been doing some funky stuff with the calendar displays, if you'd like a copy of any of my XSLT... :-)
Oh right.....it'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!
Peter
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!
Heather
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.
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.
is working on a reply...