Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I am developing an Umbraco 7.6 site where I have to use PureLive mode for Model Builder.
Is there a way to share and reuse a common @helper which uses ModeBuilder generated class between different Views/Partialviews?
If I put it in App_Code folder, it won't compile since the ModelBuilder generated class are not available to the compiler...
Is there a way to "include" one .cshtml in another?
TIA,
/M
Hi Marco
I have previously been able to add a cshtml named App_Code/MyProject/GlobalHelpers.cshtml.
In this I had the following:
@using Umbraco.Web; @helper RenderBreadcrumb(int id) { var uh = new UmbracoHelper(UmbracoContext.Current); var basenode = uh.TypedContent(id); var nodes = basenode.Ancestors().Where(x => x.GetPropertyValue("umbracoBreadcrumbHide") != "1"); <ol class="breadcrumb"> @foreach (var node in nodes) { <li><a href="@node.Url">@node.GetPropertyValue("navName", node.Name)</a></li> } <li class="active">@basenode.GetPropertyValue("navName", basenode.Name)</li> </ol> }
In my views I could then type:
@MyProject.GlobalHelpers.RenderBreadcrumb(Model.Content.Id)
And get a breadcrumb.
Don't know if it works with modelsbuilder though, but you can try!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Share common @helper with Model Builder in PureLive mode
Hi,
I am developing an Umbraco 7.6 site where I have to use PureLive mode for Model Builder.
Is there a way to share and reuse a common @helper which uses ModeBuilder generated class between different Views/Partialviews?
If I put it in App_Code folder, it won't compile since the ModelBuilder generated class are not available to the compiler...
Is there a way to "include" one .cshtml in another?
TIA,
/M
Hi Marco
I have previously been able to add a cshtml named App_Code/MyProject/GlobalHelpers.cshtml.
In this I had the following:
In my views I could then type:
And get a breadcrumb.
Don't know if it works with modelsbuilder though, but you can try!
is working on a reply...