Copied to clipboard

Flag this post as spam?

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


  • Brian Olsen 143 posts 424 karma points
    Feb 28, 2013 @ 09:47
    Brian Olsen
    0

    Razor 3 latest news articles

    how to get me this script to only write the 3 latest news articles out

     

    {

    @foreach (var item in Model.Children.Where("umbracoNaviHide != true").OrderBy("UpdateDate"))

    {

    var bodyitemhtml = @Library.StripHtml(@item.bodyText);

        <li><a href="@item.Url"><span>@item.Name</span><br>

        <span>@Library.Truncate(bodyitemhtml,150)</span>

            <em>Publiceret: @umbraco.library.LongDate(@item.UpdateDate.ToString(), true, " - ")</em></a>

        </li>

    }

    }

  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 28, 2013 @ 10:07
    Fuji Kusaka
    100

    Hi Brian,

    Change this

    @foreach (var item in Model.Children.Where("umbracoNaviHide != true").OrderBy("UpdateDate"))

    to

    @foreach (var item in Model.Children.Where("umbracoNaviHide != true").OrderBy("UpdateDate").Take(3))
  • Brian Olsen 143 posts 424 karma points
    Feb 28, 2013 @ 10:13
    Brian Olsen
    0

    super

Please Sign in or register to post replies

Write your reply to:

Draft