Could anyone help me construct some xslt to show the top pages under a specific node in the system?
I've tried searching on here, but people seem to have a problem that's more complex than that or isn't quite the same.
From that, I can build in the bits I need. I'm basically building a latest news feed for the front page of a site and need to point the xslt to the right node so it can pick the latest three items.
If this information is already out there, then apologies for the doubel post.
Thanks a lot for this. I do have a custom publish date so that should work well.
One question though - what should I substitute into the boxes you've highlighted (NewsContainerAlias and NewsItemAlias)? Is it the document type aliases?
Yep - the aliases (you can see them on the Properties tab, but generally they're Pascal-/camelCased versions of the Name, e.g. "News Container" -> "NewsContainer" for documents and "News Date" -> "newsDate" for properties)
For the landing page, I have used the same document type as the news items, but changed the template so it displays the contents of a macro which loops through and pulls out everything from below and displays in date order. Could I use the alias of the template, or should I create a new document type and then re-create the node?
Just for future reference, what is usually considered best practice for node levels? I've always been curious as to what other people do and how much effort they put into getting document types right from the beginning.
You can use it like it is — the way the $newsRoot variable is set up it will select all the NewsContainer nodes that are direct children of the $siteRoot (usually you have only one at this level anyway) - so it will work using the same alias as the NewsItem nodes because they're located below the $newsRoot.
You have a LOT of flexibility in this - you can match on the specific ID of a node if necessary - but that's generally not very portable as you sure will know.
I'd say it's VERY important to think about how your content structure is going to be before you do any building in Umbraco - they determine the URL structure of your site, so that's very good to "nail" before you've done too much.
Show top 3 nodes
Hi,
Could anyone help me construct some xslt to show the top pages under a specific node in the system?
I've tried searching on here, but people seem to have a problem that's more complex than that or isn't quite the same.
From that, I can build in the bits I need. I'm basically building a latest news feed for the front page of a site and need to point the xslt to the right node so it can pick the latest three items.
If this information is already out there, then apologies for the doubel post.
Thanks,
Tom
Hi Tom,
Here's a starter for you - you need to change a couple of aliases to make it work - I've tried to highlight the one's in question:
(If you haven't got a custom datetime property on them, you can use @createDate instead of newsDateProperyyAlias)
Feel free to ask
/Chriztian
Thanks a lot for this. I do have a custom publish date so that should work well.
One question though - what should I substitute into the boxes you've highlighted (NewsContainerAlias and NewsItemAlias)? Is it the document type aliases?
Yep - the aliases (you can see them on the Properties tab, but generally they're Pascal-/camelCased versions of the Name, e.g. "News Container" -> "NewsContainer" for documents and "News Date" -> "newsDate" for properties)
/Chriztian
Hmm.. I think I may hit a problem with that.
For the landing page, I have used the same document type as the news items, but changed the template so it displays the contents of a macro which loops through and pulls out everything from below and displays in date order. Could I use the alias of the template, or should I create a new document type and then re-create the node?
Just for future reference, what is usually considered best practice for node levels? I've always been curious as to what other people do and how much effort they put into getting document types right from the beginning.
Thanks for your help so far, by the way!
No problem Tom!
You can use it like it is — the way the $newsRoot variable is set up it will select all the NewsContainer nodes that are direct children of the $siteRoot (usually you have only one at this level anyway) - so it will work using the same alias as the NewsItem nodes because they're located below the $newsRoot.
You have a LOT of flexibility in this - you can match on the specific ID of a node if necessary - but that's generally not very portable as you sure will know.
I'd say it's VERY important to think about how your content structure is going to be before you do any building in Umbraco - they determine the URL structure of your site, so that's very good to "nail" before you've done too much.
/Chriztian
is working on a reply...