ASP.NET MVC 3,如何做正确的主题 [英] ASP.NET MVC 3, how to do themes right
问题描述
我要找的输入就如何以最好的方式做主题,在MVC 3。我想需要一个自定义视图引擎采取定位查看文件等服务。
I'm looking for input on how to do "themes" in MVC 3 in the best way. I guess a custom view engine is needed to take care of locating the view files etc.
我也想为主题系统是可扩展的,因此,如果这只是一个视图我想改变别人还在使用默认值。有点像果园项目呢?
I also would like the theme system to be extensible, so that if it's only one of the views I would like to change the others still use the default. Kind of like the Orchard project does?
一个想象一个文件夹结构喜欢〜/主题/默认/浏览次数等。
A imagine a folder structure like ~/Themes/Default/Views etc.
我已经找到了几个MVC 1.0和2.0的例子,但没有适合我的需求完全吻合。我需要的东西通吃的优势ASP.NET MVC 3.0功能和糖果中的Razor视图引擎:)
I have found a few MVC 1.0 and 2.0 examples, but nothing that fits my needs exactly. I need something that takes advantage of all the ASP.NET MVC 3.0 features and goodies of the Razor view engine :)
任何输入和想法真的会被AP preciated
Any input and ideas will really be appreciated
-
基督教
-- Christian
推荐答案
查看 FunnelWeb 的博客引擎。
它的开放源码,code是非常可读的,它使用MVC3,它有对主题的支持
Its open source, the code is very readable, it uses MVC3 and it has support for themes
FunnelWeb是写在ASP.NET MVC 3,使用的Razor视图引擎。该人士$ C $ c是简单易中跳。
FunnelWeb is written in ASP.NET MVC 3, using the Razor view engine. The source code is simple and easy to jump in to.
做的最好的事情就是下载源(释放或开发),并检查的主题是如何实现的。
The best thing to do is to download the source (release or dev) and check how themes are implemented.
是的,使用自定义视图引擎。看看 FunnelWebViewEngine
有code是这样的:
And yes, a custom view engine is used. Check out FunnelWebViewEngine
which has code like this:
lastEngine = new RazorViewEngine();
lastEngine.ViewLocationFormats =
new[]
{
"~/Themes/" + settings.Theme + "/Views/{1}/{0}.cshtml",
这篇关于ASP.NET MVC 3,如何做正确的主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!