我是 MVC 新手,但正在努力寻找解决方法。我目前正处于这样的阶段:我知道的足够危险,但还不足以真正做任何有用的事情。
我正在建立一个网站,我希望它能够非常灵活地“换肤”。它最终也可能会很大,所以我真的想使用区域。
我正在考虑让自己陷入困境,看看是否可以构建一个既具有区域感知又具有主题支持的自定义视图引擎。我想这是这两篇文章的混合体。
在我开始之前 - 而且更重要的是 - “在我开始、脱发、完成、实施和构建我的大型应用程序之前”,如果有人认为这是一个好主意,可以发表评论吗?
我只是想知道是否有一个图书馆已经做到了这一点,或者是一种我完全缺少的更简单的方法......
非常欢迎任何建议!
预先感谢,
Z
I'm new to MVC but am working hard to find my way through it. I'm currently at the point where I know enough to be dangerous, but not quite enough to actually do anything useful.
I'm building a site which I'd like to be very flexibly "skinable". It could also end up quite large, so I really want to use areas.
I'm thinking of throwing myself in the deep end and seeing if I can build a custom view engine that is both area aware and has theme support. I guess that it's kind of a hybrid of these two articles.
Before I start - and also, more to the point - "before I start, lose hair, finish, implement and build my massive app on it", can anyone comment if they think that this is a good idea?
I'm just wondering if there's a library out there that already does this, or a much easier way that I'm completely missing...
Any suggestions most welcome!!
Thanks in advance,
Z
发布评论
评论(1)
如果你要做某事,通常最好有一个充分的理由去做这件事。
如果您的目标是启用主题,最简单的方法是在 viewData 中设置主题,并让自定义 HtmlHelper 根据 viewdata 的主题键包含必要的 .css 和 .js 引用。
为了获得更强大的解决方案,Telerik 有 ASP.NET MVC 的开源扩展,这对于开发 UI 并启用主题功能非常有用:http://demos.telerik.com/aspnet-mvc 。使用他们的入门套件可能会节省您很多时间。
If you're going to do something, it's generally a good idea to have a good reason to do it.
If you're objective is to enable themes, the easiest way to do this is to set the theme in viewData and have a custom HtmlHelper include the necessary .css and .js references based on the viewdata's theme key.
For a more robust solution, Telerik has an open source extension of ASP.NET MVC, which is very useful for developing your UI and enables theme-functionality : http://demos.telerik.com/aspnet-mvc . Using their starter kit would probably save you a good bit of time.