Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @using System;
- @using umbraco.MacroEngines;
- @inherits umbraco.MacroEngines.DynamicNodeContext
- @{
- int eventCategoryFolderId;
- if(!int.TryParse(Parameter.EventCategoryFolderId, out eventCategoryFolderId))
- {
- // not specified? use homepage
- eventCategoryFolderId = -1;
- }
- dynamic eventCategoryFolder = new DynamicNull();
- dynamic eventNodes = new DynamicNull();
- try
- {
- eventCategoryFolder = Model.NodeById(eventCategoryFolderId);
- eventNodes = eventCategoryFolder.Descendants("Event").Where("Visible && endDate > DateTime.Now");
- }
- catch(Exception ex)
- {
- <h3>There was some sort of problem. Possibly an invalid category... Drats...</h3>
- }
- }
- @if (eventNodes.Any())
- {
- <h2>@eventCategoryFolder.Name</h2>
- <ul>
- @foreach (var eventItem in eventNodes.OrderBy("startDate desc"))
- {
- <li>
- <div>
- <h3><a href="@AutoFolders.XsltExtensionLibrary.NiceUrl(eventItem.Id)">@eventItem.Name</a></h3>
- <small>@eventItem.startDate.ToString("MMMM dd") @Html.Raw(" - ") @eventItem.endDate.ToString("MMMM dd")</small>
- </div>
- <div class="clear"></div>
- </li>
- }
- </ul>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement