Copied to clipboard

Flag this post as spam?

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


  • Klaus Bergh 8 posts 76 karma points
    Jan 11, 2016 @ 13:11
    Klaus Bergh
    0

    Tutorial for using list view for creating a news page

    Hi

    I am new to umbraco, but i hope someone can help me creating a simple newspage

    What i think is a page with the headlines listet, and when my user click this headline they will se the full history.

    Is this possible?

  • Dennis Aaen 4490 posts 18155 karma points admin hq c-trib
    Jan 11, 2016 @ 13:20
    Dennis Aaen
    0

    Hi Klaus,

    Yes this is possible. What you need to do is is to creating a document type for a News overview page, if you want this and then a document type for the news item.

    See this video chapter of how Umbraco document types are working in Umbraco.

    https://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/document-types/what-is-a-document-type/

    When this is in place then you need to write some code to get the data out. It could be Razor. In Umbraco you will find some Razor pre-code snippets, and if you are doing the setup with an overview page where you have the news items as children, then you can use the Razor code below.

    @{ var selection = CurrentPage.Children.Where("Visible"); }
    
    @if (selection.Any())
    {
        <ul>
            @foreach (var item in selection)
            {
                <li>
                    <a href="@item.Url">@item.Name</a>
                </li>
            }
        </ul>
    }
    

    With this could will get the node name of the news item and a link to the news item. If you have some custom properties then you can call it regarding to the example above @item.AliasOfCustomProperty.

    Hope this helps and make sense, if not donĀ“t hessite to ask again.

    /Dennis

  • Dennis Aaen 4490 posts 18155 karma points admin hq c-trib
    Jan 11, 2016 @ 13:22
    Dennis Aaen
    0

    Another thing you could do is setup another Umbraco installation with the TXT starter kit installed.

    This starter kit has news section where it shows news items, as children to the news overview page.

    Hope this can help too.

    /Dennis

  • Casper Andersen 126 posts 508 karma points
    Feb 03, 2016 @ 10:40
    Casper Andersen
    1

    I have made some tutorials on youtube and one of them is about how to make a list of news items, i am still making tutorials when i can, perhaps these can help you out.

    https://www.youtube.com/watch?v=Z5hKnDI0NIw&list=PLLYO0Qmbv5pvGjpI6Cyg3mVBoYtG_LK63

Please Sign in or register to post replies

Write your reply to:

Draft