Can you post how your tree looks. So we can see where the articles are located in the content tree. And how do you determine if article should be visible in this top 5 list.
Dependig on where you are trying to list top 5 articles you should be able to do it with the code below. If you can tell where you need to display it maybe you can do it with less code.
First you are finding the first node of the type projects and then looping though the children. Then we order the nodes by the create date, and taking 5 items out of the collection.
Remember to change AliasOfProject, so it match the alias for the Projects page.
Thanks that helped me on my 'Projects' page, but what should I do, when I'm on a specific article that has no pagination and I can't use the 'items' variable.
Listing top 5 articles
Hi
I'm working on a website - where I have a sidebar on the right side, where I want to display top 5 latest articles
This is how it looks like:
Does anyone know how to do that, because I have no clue. I would really appreciate some help.
Thanks in advance!
//Sharmarke Hujale
Hi Sharmake,
Can you post how your tree looks. So we can see where the articles are located in the content tree. And how do you determine if article should be visible in this top 5 list.
Dave
Of course - here it is:
Hi Sharmarke,
Dependig on where you are trying to list top 5 articles you should be able to do it with the code below. If you can tell where you need to display it maybe you can do it with less code.
First you are finding the first node of the type projects and then looping though the children. Then we order the nodes by the create date, and taking 5 items out of the collection.
Remember to change AliasOfProject, so it match the alias for the Projects page.
Hope this helps,
/Dennis
Hi Dennis
Thanks for your help, but I ran into a problem - I used your code and changed the alias, but nothing gets displayed, can you help me with that?
This is how the whole 'Project' documentType looks like:
And 'the latest' articles are at the bottom
Hi Sharmarke,
Okay so you want to display the latest 5 articles on the projects page as I understand your code.
Try this code snippet.
Hope this helps,
/Dennis
Hi Dennis,
Thanks that helped me on my 'Projects' page, but what should I do, when I'm on a specific article that has no pagination and I can't use the 'items' variable.
Can you help me with that?
The specific page's code looks like this:
/Sharmarke
Hi Sharmake,
This code below should show the latest five articles when you are on a article.
Hope this helps,
/Dennis
Hi Dennis
It did work!
Thank you for your help!
/Sharmarke
is working on a reply...