Copied to clipboard

Flag this post as spam?

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


  • Kevin Walker 66 posts 87 karma points
    Jul 02, 2013 @ 22:44
    Kevin Walker
    0

    Showing output from .cshtml in the Umbraco back office on a document type.

    I have a simple .cshtml file as per the default Navigation template in Umbraco.

    @inherits umbraco.MacroEngines.DynamicNodeContext

    @{ 

    @*Get the root of the website *@

        var root = Model.AncestorOrSelf(1);

    }

    <ul>

        @foreach (var page in root.Children.Where("Visible"))

        { 

            <li class="@page.IsAncestorOrSelf(Model, "current", "")">

                <a href="@page.Url">@page.Name</a>

            </li>

    }

    </ul>

    The above obviously displays the site naviation front end when assigned to a macro and added to a template. That is fine. However, if I wanted to show the same output from this Razor script in the Umbraco back office on a node / document type as a way of previewing to the Nav to the user, what would be the correct / best process to achieve this in order that they would see the same output as the front end when they are on that node in the CMS?

Please Sign in or register to post replies

Write your reply to:

Draft