I've been working on splitting a multisite installation of Umbraco.
I've manged to split the sites and upgrade em from Umbraco 4.7.2 to the newest version of v7.
I'm having some trouble with the news section though, since our client often create news items and set the to publish later.
I've tried Googling on wether it's possible to sort by publish date, but all posts I've found so far, tells that publishDate aren't in the XML cache and therefore can't sort by that parameter, but doesn't really seem to cover any fixes/hacks.
Has anyone found a way to sort by publish date?
I hope someone here can help me. Would be much appreciated!
You would need to write a custom extension for that, since the XML cache only contains published nodes, so there's no way for XSLT to get to that info...
Probably better to use a Razor macro for it, since Razor has access to all the C# functions you'd need.
Supposedly, it will give you the date a piece of content is set to be published - mind you, that the nodeId you specify, you probably can't get from within XSLT, since (again) it isn't yet published :-)
Sorting by publish date
Hi
I've been working on splitting a multisite installation of Umbraco.
I've manged to split the sites and upgrade em from Umbraco 4.7.2 to the newest version of v7.
I'm having some trouble with the news section though, since our client often create news items and set the to publish later.
I've tried Googling on wether it's possible to sort by publish date, but all posts I've found so far, tells that publishDate aren't in the XML cache and therefore can't sort by that parameter, but doesn't really seem to cover any fixes/hacks.
Has anyone found a way to sort by publish date?
I hope someone here can help me. Would be much appreciated!
Henrik Vincent
Hi Henrik,
You would need to write a custom extension for that, since the XML cache only contains published nodes, so there's no way for XSLT to get to that info...
Probably better to use a Razor macro for it, since Razor has access to all the C# functions you'd need.
Hope that helps,
/Chriztian
Hi Chriztian
Thanks for your reply.
Is it possible to use Razor within an XLST file?
The thing is, as I mentioned, the scripts from the old sites are all XSLT, since they date back to late 2011.
I haven't really worked with Razor myself, since I got my certification back in '11, so haven't really used alot of Razor in my Umbraco "carreer".
Alright, that would be a mess - don't want to go there :)
So have a look at this uComponents extension: GetReleaseDate()
Supposedly, it will give you the date a piece of content is set to be published - mind you, that the nodeId you specify, you probably can't get from within XSLT, since (again) it isn't yet published :-)
You could try to have a look at the actual source code for that extension, and see if you could write one yourself, that could help you do what you need.
/Chriztian
But hey - are you sure that you don't just need the actual
@createDate
/@updateDate
for sorting? - Are you not just rendering stuff in the frontend?/Chriztian
Not 100 % sure, no. I've had some problems understanding all of the code, the dev made back in the day.
I've edited some of the code, to fit our clients wishes.
This is the XSLT used for listing, sorting and paginating the news items.
I've set up sorting to updateDate at the moment.
' ]>
'
So I added a new property to the doctype with a Datepicker.
In this I add the date, which should be the release date, and after this I changed the
is working on a reply...