There's currently no function for that, the values are stored in the database and not on the node so Alex approach wont work I'm afraid. A real hacky solution is something like this, but remember, each time you use the CounterService it'll create a DB request so it can be quite heavy if you have alot of nodes:
var stats = new Dictionary<IPublishedContent, int>();
foreach (var page in Model.Content.AncestorOrSelf(1).DescendantsOrSelf())
{
stats.Add(page, CounterService.GetValueBetween(page.Id, DateTime.Now.AddYears(-1), DateTime.Now));
}
<ul>
@foreach (var topStats in stats.OrderByDescending(x => x.Value).Take(3))
{
<li>@topStats.Key.Name</li>
}
</ul>
Ordering/Listing nodes by uIncrement value
Is there a way to query nodes by uIncrement value? As in, listing content on the frontend by view count?
Hi Travis
If you print our uIncrement values, what is it?
Alex
Hi Travis,
There's currently no function for that, the values are stored in the database and not on the node so Alex approach wont work I'm afraid. A real hacky solution is something like this, but remember, each time you use the CounterService it'll create a DB request so it can be quite heavy if you have alot of nodes:
// Herman
is working on a reply...