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
I am developing a plugin in Version 7. How do I configure Umbraco so that this:
@Html.Partial("~/App_Plugins/SiteData/Views/Shared/_dbButtons.cshtml")
can be shortened to this:
@Html.Partial("_dbButtons")
Hi Graham
In MVC you can add new locations for searching for Views, by creating a new ViewEngine...
... that said...
Umbraco already has a PluginViewEngine
https://github.com/umbraco/Umbraco-CMS/blob/7ee510ed386495120666a78c61497f58ff05de8f/src/Umbraco.Web/Mvc/PluginViewEngine.cs
which looks like to me is already searching in the location you are describing:
AreaPartialViewLocationFormats = new[] { //will be used when we have partial view and child action macros string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/Partials/{0}.cshtml"), string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/Partials/{0}.vbhtml"), string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/MacroPartials/{0}.cshtml"), string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/MacroPartials/{0}.vbhtml"), //for partials string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/{1}/{0}.cshtml"), string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/{1}/{0}.vbhtml"), string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/Shared/{0}.cshtml"), string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/Shared/{0}.vbhtml") };
so I'd expect your shortened version to work...
regards
Marc
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Plugin Development with route for html.partial
I am developing a plugin in Version 7. How do I configure Umbraco so that this:
can be shortened to this:
Hi Graham
In MVC you can add new locations for searching for Views, by creating a new ViewEngine...
... that said...
Umbraco already has a PluginViewEngine
https://github.com/umbraco/Umbraco-CMS/blob/7ee510ed386495120666a78c61497f58ff05de8f/src/Umbraco.Web/Mvc/PluginViewEngine.cs
which looks like to me is already searching in the location you are describing:
so I'd expect your shortened version to work...
regards
Marc
is working on a reply...