如何在其父节点上显示多节树选取器值

时间:2015-07-03 12:26:07

标签: node.js umbraco7

您好我需要帮助如何呈现我的多节点树选取器值(http://screencast.com/t/NTu1NqXsTmBz)以在其名为PORTFOLIO的父节点上显示它。

我希望多节点选择器值应该放在“投资组合”和“关于”部分(http://screencast.com/t/F0Dnnv9a)之间,但我不知道我是怎么尝试渲染它仍然无法工作..

这是完成模板:screencast.com/t/ar1zeZ43Pf6J

节点树选择器代码:

@if (Model.Content.HasValue("mntp_pickContent"))
{
    var bannerListValue = Model.Content.GetPropertyValue<string>("mntp_pickContent");
    <div id="container" class="container-portfolio">
     @foreach (var item in bannerListValue.Split(','))
        {
         var page = Umbraco.Content(item);
        <div class="col-md-4 element branding">
            <div class="portfolio-item flip ">
                <div class="flip-content">
                    <div class="front"> 
                        <a href="#"> <img width="360" height="249" src="@page.Url" class="attachment-project-thumb wp-post-image" alt="background4" /> </a> 
                    </div>
                            <div class="back">
                                <div class="back-content">
                                    <h4><a href="@page.contentLink" title="Project Name" class="open-popup">@page.contentTitle</a></h4>
                                    <div class="txt-project">
                                        <p>@page.contentsubTitle</p>
                                    </div>
                                    <a href="@page.Url" class="open-popup more"><i class="fa fa-plus"></i> More</a>
                                </div>
                            </div>
                </div>
            </div>
                <!-- flip container -->
        </div>
        }
    </div>
}

父节点Portfolio.cshtml

@{ if (Model.Content.HasValue("port_backImage"))
 {
     var bgport = Umbraco.TypedMedia(Model.Content.GetPropertyValue<string>("port_backImage"));
    <section class="section-wrap section-portfolio" style="background-image: url(@bgport.Url)" id="portfolio">
        <div class="container">
            <div class="container-wrap row portfolio">
                <div class="container-wrap-title col-md-6">
                    <h2>@Model.Content.GetPropertyValue("pageTitle")</h2>
                    <h6>@Model.Content.GetPropertyValue("subTitleText")</h6>
                </div>
                <div class="container-wrap-subnav col-md-6">
                    <ul class="subnavigation" id="filters">
                        <li class="active"><a href="#" data-filter="*">show all</a></li>
                        @foreach (var portMenu in Model.Content.Children)
                        {
                            <li><a href="@portMenu.Url" data-filter=".@portMenu.UrlName">@portMenu.Name</a></li>
                        }
                    </ul>
                </div>
            </div>
        </div>
    </section>
 }
}

1 个答案:

答案 0 :(得分:0)

这完全取决于您使用的模板引擎。

如果您使用的是MVC,则需要将MNTP逻辑添加到局部视图中。 请参阅以下链接: https://our.umbraco.org/documentation/Reference/Templating/Mvc/partial-views

如果您使用的是WebForms,则需要将逻辑添加到Razor文件或UserControl(.ascx)文件中。请参阅以下链接:

https://our.umbraco.org/documentation/reference/templating/macros/

https://our.umbraco.org/documentation/reference/templating/macros/Razor/

http://umbraco.com/help-and-support/video-tutorials/introduction-to-umbraco/developer-introduction/using-net-user-controls