Skip to content

Instantly share code, notes, and snippets.

@jesulink2514
Last active December 22, 2015 04:08
Show Gist options
  • Save jesulink2514/ea17fa717f602f000a2f to your computer and use it in GitHub Desktop.
Save jesulink2514/ea17fa717f602f000a2f to your computer and use it in GitHub Desktop.
Motor de vista con soporte para temas
using System;
using System.Web;
using System.Web.Mvc;
namespace MvcThemeable.Infraestructura
{
public class ThemeViewEngine: RazorViewEngine
{
public ThemeViewEngine(string tema)
{
ViewLocationFormats = new[]
{
"~/Views/Themes/"+tema + "/{1}/{0}.cshtml",
"~/Views/Themes/"+tema + "/Shared/{0}.cshtml"
};
PartialViewLocationFormats = new[]
{
"~/Views/Themes/"+tema + "/{1}/{0}.cshtml",
"~/Views/Themes/"+tema + "/Shared/{0}.cshtml"
};
AreaViewLocationFormats = new[]
{
"~/Areas/{2}/Views/Themes/"+tema + "/{1}/{0}.cshtml",
"~/Areas/{2}/Views/Themes/"+tema + "/Shared/{0}.cshtml"
};
AreaPartialViewLocationFormats = new[]
{
"~/Areas/{2}/Views/Themes/"+tema + "/{1}/{0}.cshtml",
"~/Areas/{2}/Views/Themes/"+tema + "/Shared/{0}.cshtml"
};
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment