umco/umbraco-nested-content

How to render widget template on page template

Opened this issue · 1 comments

I apologize for asking this here, but i haven't gotten any response on the umbraco forums and I'm stuck in a major way.

How do I add the template for my widget to the template for my page? I'm sorry if I'm not using the correct terminology here. I'll provide the code I'm using and maybe that'll clarify the trouble i'm having...

The DocType for my widget is called "wLefty", the DocType for my page is called "Demo".

The template for my Nested Content widget is called wLefty and here is that code...

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.WLefty>
@using ContentModels = Umbraco.Web.PublishedContentModels;
@{
    Layout = null;
    var item = Model.GetPropertyValue<IPublishedContent>("wLefty");
}

<div class="clearfix"></div>  
<div class="row-fluid clearfix noPadding rowMargin">
    <div class="col-xs-12 col-sm-10 col-sm-offset-1 col-lg-8 col-lg-offset-2 nopadding lefty-container">
        <div class="col-xs-12 col-sm-10 col-sm-offset-2 nopadding lefty-background">
            <img src="@Umbraco.Field(item, "wLeftyImage")" class="xs-img-responsive" />
        </div>
       <div class="col-xs-10 col-xs-offset-1 col-sm-5 col-sm-offset-0 col-lg-4 lefty-page">
            @if (string.IsNullOrWhiteSpace(@Umbraco.Field(item, "wLeftyCursive")) == false){
                <h3 class="handwritten">@Umbraco.Field(item, "wLeftyCursive")</h3>
            }
            <h2>@Umbraco.Field(item, "wLeftyTitle")</h2>
            <div class="BGhr-container"><div class="BGhr">&nbsp;</div></div>
            @Umbraco.Field(item, "wLeftyCopy")
            @if (string.IsNullOrWhiteSpace(@Umbraco.Field(item, "wLeftyButtonLink")) == false){
                <div class="abtnContainer center-block"><a href="@Umbraco.Field(item, "wLeftyButtonLink")" class="aBtn allcaps">Button<i class="fa fa-chevron-right" aria-hidden="true"></i></a></div>
            }
        </div>
    </div>
</div>

The template for my page is called Demo (this is where I'm unclear how to add the widget to my page template)...

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
    Layout = "Page.cshtml";
}

@* the fun starts here *@
<h1>LEFTY</h1>
@* How do I add my wLefty widget here? *@

Update...I tried this, but nothing got rendered:

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
    Layout = "Page.cshtml";
}

@* the fun starts here *@
<h1>LEFTY</h1>
@Umbraco.RenderTemplate(1064)

@s15199d I've replied on the forum post :-)

https://our.umbraco.org/projects/backoffice-extensions/nested-content/nested-content-feedback/87112-how-to-render-my-nested-content-widget-template-on-my-page-template#276201

Closing this ticket off, as ideally we want to use GitHub issues for bugs/features, not implementation concerns.

All the best with your Umbraco implementation.