Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kim Bantz Rasmussen 81 posts 310 karma points
    Aug 17, 2012 @ 10:34
    Kim Bantz Rasmussen
    0

    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:

    @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><href="/timeline.aspx?tag=@tag" title="@tag">@tag</a></li>
                    }
                    </ul>
                  }
                }
                 
              </li>
        }
        </ul>  
    } 
  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Aug 22, 2012 @ 09:49
    Jeroen Breuer
    0

    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

  • Kim Bantz Rasmussen 81 posts 310 karma points
    Aug 22, 2012 @ 10:31
    Kim Bantz Rasmussen
    1

    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><href="@node.Url" title="@node.Name">@node.pageTitle</a></h1>
            <class="lead">@node.timelineTeaser</p>
            <href="@node.Url" title="@node.Name" class="readmore">&#9658; Læs mere</a>
          </header>
          <div class="elementImage">

          @if (@node.HasValue("timelinePhoto"){
            
            dynamic mediaItems @node.timelinePhoto.mediaItem;
            <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
              
      }
    }
Please Sign in or register to post replies

Write your reply to:

Draft