I'll start by saying this is either a real brain buster, or I'm stupid :)
I've been working on this for quite a long time now. I have 6 blogs set up on my company's site (not yet live thank god). I have almost everything that NEEDS to be working all set. There is sort of a 'blog network' homepage that has the most recent posts from every blog. Sounds simple enough. That part was. The hangup is in a small design element.
We have a large date next to every entry. The date should not show up again if the following post has the same date. I tried setting this up so the preceding posts' date was compared to the current post and if they matched, I didn't have the date show up. The issue I have run into is getting the createDate or postedDate (attribute I added for back-dating posts) from that preceding node. They only share the root node as a parent so the structure is this
Home
-BlogA
--Year
---Month
----Day
-----PostA
-BlogB
--Year
---Month
----Day
-----PostB
I just don't know how to find that PostA date when cycling throught all of this so I can't compare it to PostB's date.
Any ideas? Even a starting point would be helpful.
I believe you are asking for how to get the previous sibiling's data in a sorted list of Blog Posts. The following discussion may have the answer you need.
Now would be a good time to read about 'Muenchian Grouping' - Jeni Tennison explains it very well here: http://www.jenitennison.com/xslt/grouping/muenchian.html - so you can group by date and only show the date next to the first item.
This code creates a variable containing a list of blogPost nodes from the various blogs that is sorted by a date in a set property. (You can use @createDate instead if you like, but then you'll have to do a substring comparison on the datepart of the attribute in the last if statement)
This variable is converted into a node set with the msxml:node-set function, and this nodeset is then listed out.
Getting attribute from another node
Hey All,
I'll start by saying this is either a real brain buster, or I'm stupid :)
I've been working on this for quite a long time now. I have 6 blogs set up on my company's site (not yet live thank god). I have almost everything that NEEDS to be working all set. There is sort of a 'blog network' homepage that has the most recent posts from every blog. Sounds simple enough. That part was. The hangup is in a small design element.
We have a large date next to every entry. The date should not show up again if the following post has the same date. I tried setting this up so the preceding posts' date was compared to the current post and if they matched, I didn't have the date show up. The issue I have run into is getting the createDate or postedDate (attribute I added for back-dating posts) from that preceding node. They only share the root node as a parent so the structure is this
Home
-BlogA
--Year
---Month
----Day
-----PostA
-BlogB
--Year
---Month
----Day
-----PostB
I just don't know how to find that PostA date when cycling throught all of this so I can't compare it to PostB's date.
Any ideas? Even a starting point would be helpful.
Andrew
Andrew,
I believe you are asking for how to get the previous sibiling's data in a sorted list of Blog Posts. The following discussion may have the answer you need.
http://our.umbraco.org/forum/developers/xslt/8098-Get-property-of-sibling-within-loop
--Chris
Hi Andrew,
You should definitely look into using keys for this, i.e., define a key to lookup posts by their posted date:
Now you can find all posts from any date using the key() function:
So far, so good...
Now would be a good time to read about 'Muenchian Grouping' - Jeni Tennison explains it very well here: http://www.jenitennison.com/xslt/grouping/muenchian.html - so you can group by date and only show the date next to the first item.
Hope it helps, otherwise let us know,
/Chriztian
This can be done without keys and Muenchian Grouping:
This code creates a variable containing a list of blogPost nodes from the various blogs that is sorted by a date in a set property. (You can use @createDate instead if you like, but then you'll have to do a substring comparison on the datepart of the attribute in the last if statement)
This variable is converted into a node set with the msxml:node-set function, and this nodeset is then listed out.
Regards
Jesper Hauge
Hi Everyone,
Thanks for all of your responses. Let me read through everything and I'll let you know what works.
is working on a reply...