관련 기사 목록을 가져 오는 Umbraco v6.2.4의 부분보기를 사용하고 있습니다. 아래 스크립트는 완벽하게 작동하며 "Refactored.Umbraco.MVCExtensions"를 사용하여 기사의 조회수를 추출합니다. 지금까지 그렇게 좋았지 만 가장 인기있는 기사, 즉 조회수를 기준으로 기사 목록을 정렬/정렬하고 싶습니다. 그러나 뷰 수는 Umbraco 모델의 일부가 아니므로이를 기반으로 목록을 정렬/정렬하는 방법이나이 작업을 수행하는 다른 방법이 있는지 모르겠습니다.Umbraco 면도기 Orderby 맞춤 속성
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using Refactored.UmbracoViewCounter
@{
var articles = Model.Content.AncestorOrSelf(4).Children.Where(x => x.IsVisible()).OrderBy("articleCategory, articleDate desc");
int pagerank = 1;
string elementId;
<div>
<p class="h3">Most Popular</p>
@foreach (var item in articles.Take(6))
{
elementId = "content_" + pagerank.ToString();
<div class="items @elementId">
<span class="pagerank">@pagerank</span>
<a href="@item.Url">
<p>@(item.GetPropertyValue<string>("title"))</p>
</a>
<span class="views-counter"> @ViewCount.GetViewCount(item.Id, category: "articles", increment: false)</span>
</div>
pagerank = pagerank + 1;
}
</div>
은}
조회수를 어떻게 저장했는지 알려줄 수 있습니까? –
뷰 카운트는 "dbo.refViewCount"라는 테이블의 Umbraco 데이터베이스에 저장됩니다. 이 테이블은 id, nodeId, count, lastViewed 및 category를 포함합니다. – user3429664