Created
October 27, 2017 10:00
-
-
Save ps-team/26b74e8388bc1c855eb1c0167fff5563 to your computer and use it in GitHub Desktop.
Events mini list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using Contensis.Framework.Web | |
@using Contensis.Framework.Web.Search | |
@{ | |
var newsArticlesQuery = Query.Where("SC_T_ID").IsEqualTo("-258875"); /* add template id for news here */ | |
var newsArticles = new NodeFinder().Find(newsArticlesQuery); | |
var utils = new CMS_API.Common.BaseUtilities(); | |
var currentDate = DateTime.Today; | |
} | |
<div class="sys_miniList sys_miniListEvents"> | |
<h2>Latest <span>Events</span></h2> | |
@foreach(var newsArticle in newsArticles.Where(eA => eA.Data.enddate >= currentDate).OrderBy(eA => eA.Data.startdate).Take(3)) | |
{ | |
var description = newsArticle.Data.Description.ToString(); | |
<div class="sys_miniListItem"> | |
<h3><a href="@newsArticle.Path" title="@newsArticle.Title">@newsArticle.Title</a></h3> <span class="sys_miniListDate">@newsArticle.Data.startdate.ToString("d/M/yyyy") - @newsArticle.Data.enddate.ToString("d/M/yyyy") </span> | |
<p class="sys_miniListDescription">@description.Substring(0, 50)… <a href="@newsArticle.Path" title="@newsArticle.Title" class="sys_miniListLink">[+]</a></p> | |
</div> | |
} | |
<a href="/en/Events/Events.aspx" class="sys_miniListLink">See all events</a> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment