Thanks! work. about the second thing (showing just the latest articles) - is it possible to do it with out sorting? Like, how does the CMS store each node (page / article) that added? How does it order it? Is it possible do it with out new var / etc?
I think you're going to need to sort to get them in newest order. By default, the nodes sort the same way they show in the backoffice (first to last in order added, but could be different if the user clicks Sort and changes things themselves). So if you want to ensure you're getting the latest, you'll want to use OrderBy with whichever field you want to sort by (ie a custom date picker or createDate).
You can certainly do it without the new var stuff, ie foreach (var item in Imaging_pagesToList.OrderBy("createDate desc").Take(5).Skip(5)) etc...
Node offset - is it possible?
Hello
I want to display the first 8 / 10 items of each node (childrens) on home page.
So I'm use the foreach loop as follow:
and then I use a second loop:
However, I want that the second loop will begin from item number 5
And then another loop for another two items which I like to begin from item number 8 of course
As well as - I'm always want to show just the last 8 items - mean - the newst articles which added - how do I do it?
The offset
And also make sure I'm show just the latest articles (wach item is an article which added)
Thanks
Hi,
Is Skip what you're looking for? If you want to start at item #5 and grab the next 5 nodes, you could try:
To sort you can do something like:
Hope this helps,
Tom
Thanks! work. about the second thing (showing just the latest articles) - is it possible to do it with out sorting? Like, how does the CMS store each node (page / article) that added? How does it order it? Is it possible do it with out new var / etc?
I think you're going to need to sort to get them in newest order. By default, the nodes sort the same way they show in the backoffice (first to last in order added, but could be different if the user clicks Sort and changes things themselves). So if you want to ensure you're getting the latest, you'll want to use OrderBy with whichever field you want to sort by (ie a custom date picker or createDate).
You can certainly do it without the new var stuff, ie foreach (var item in Imaging_pagesToList.OrderBy("createDate desc").Take(5).Skip(5)) etc...
Thanks!!!! Work!!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.