Views and themes in version 3.40

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 years ago
Hello everybody,

We are adapting all our plugins to the new version. Something we used before, was the mechanism of views being overriden by the theme, also in the plugins.

Now, according to the release notes, we are suposed to return physical paths. I understand that, in any case, that would give us freedom to return any path that we want to, but I don't really understand if it's a preferred way to matain the previous functionality. What I would like to get (if it's possible) is look for the plugin view in a default path, and then in the same path but inside the themes folder.

I'll try to explain it a little bit clear. If you have:

return View("SomeNamespace.To.My.View", model);


As it is not a physical path, the custom view engine tries to look on different locations:

~/Themes/MyTheme/Views/MyController/The name of the view.cshtml
~/Themes/MyTheme/Views/Shared/The name of the view.cshtml
~/Views/MyController/The name of the view.cshtml
~/Views/Shared/The name of the view.cshtml


If a physical path is returned, the result is very different. As it is normal, mvc will only try to reach the physical path provided:
~/Plugins/Folder/Views/Controller/The name of the view.cshtml

What I'd like to know is what is the recommended approach to mantain a funcionality at least similar to the first example.

Thanks!
9 years ago
The "Custom View Engine" method (found here http://www.pronopcommerce.com/3-ways-to-display-views-in-your-nopcommerce-plugins-embedded-resource-theme-override-and-custom-view-engine) seems to do the trick
9 years ago
Yep, I did a custom view engine.  Works nicely.  It's not in the article but it's to be noted.  The content needs to be changed to copy always or copy if newer.  If not, it will complain that it can't find the view.

Do this on your views and any css, javascript or pictures that you have.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.