In the 'Cultiv Razor Examples' everything runs smooth as butter (4.7.1), but when a copy code into my new 4.8 project, it fails. I hope i can borrow a second pair of eyes :)
This should list all 'timestamps' in a timeline, each with a image:
@inherits umbraco.MacroEngines.DynamicNodeContext @using DigibizAdvancedMediaPicker; @{ var root = Model.AncestorOrSelf(); var nodes = root.Descendants().Where("NodeTypeAlias == @0 and Visible", "Timestamp"); <ul> @foreach (var node in nodes.OrderBy("timelineDate desc")) { string[] tagsList = @node.tags.ToString().Split(','); //DAMP Classic dynamic media = @node.MediaById(@node.timelinePhoto); <li style="color:#fff;"> <h1>@node.pageTitle</h1> <h3 style="margin-top: 20px;">Razor DAMP classic sample</h3> <img src="@media.umbracoFile" alt="@media.nodeName" height="400px"/> @if (@node.HasProperty("tags")) { if (tagsList.Count() > 0) { <ul> @foreach (var tag in tagsList) { <li><a href="/timeline.aspx?tag=@tag" title="@tag">@tag</a></li> } </ul> } } </li> } </ul> }
I have a problem with 4.8 ...
Hi Forum!
In the 'Cultiv Razor Examples' everything runs smooth as butter (4.7.1), but when a copy code into my new 4.8 project, it fails. I hope i can borrow a second pair of eyes :)
This should list all 'timestamps' in a timeline, each with a image:
Hello,
Have you already been able to fix this? If not could you give some more info about the exception. For example the stack trace.
Jeroen
Yes, it is fixed! Thanks!
Code:
@{
var root = Model.AncestorOrSelf();
var nodes = root.Descendants().Where("NodeTypeAlias == @0 and Visible", "Timestamp");
foreach (var node in nodes.OrderBy("timelineDate desc"))
{
<article class="eleven columns timelineElement element">
<header>
<span class="date">@node.timelineDate.ToString("dd.MM.yyyy")</span>
<h1><a href="@node.Url" title="@node.Name">@node.pageTitle</a></h1>
<p class="lead">@node.timelineTeaser</p>
<a href="@node.Url" title="@node.Name" class="readmore">► Læs mere</a>
</header>
<div class="elementImage">
@if (@node.HasValue("timelinePhoto")) {
dynamic mediaItems = @node.timelinePhoto.mediaItem;
<a href="@node.Url" title="@node.Name">
@if (mediaItems.Count() != 0)
{
foreach (var item in mediaItems)
{
var image = item.Image;
<img data-original="@image.umbracoFile" src="/css/images/lazy.gif" class="lazy" alt="@image.nodeName" />
<noscript><img src="@image.umbracoFile" /></noscript>
}
}
</a>
}
</div>
</article>
}
}
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.