ASP.NET MVC 项目和可扩展/皮肤系统的最佳实践是什么?
我一直想知道在 MVC 中创建项目的最佳实践,并让其他人为其创建扩展/模块/插件和皮肤/主题等。
例如,WordPress 在这方面很棒。只需上传文件或文件夹。或者甚至直接从 WP 管理浏览插件并通过简单的单击进行安装。
这里有人对如何创建一个具有这种灵活性的项目有一些建议吗? 对于皮肤,我可能需要实现我自己的视图引擎,对吗?
任何好的资源和技巧都会很棒。
谢谢!
I've been wondering about best practices on creating a project in MVC, and let others create extension/modules/plugins and skins/themes etc, for it.
For example WordPress is great at this. Just upload a file or folder. Or even browse the plugins directly from your WP administration and install by a simple click.
Does anybody here have a few tips on how to create a project that allows that flexibility.
For the skins I might need to implement my own viewengine, right?
Any good resources and tips would be great.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
换肤并不难,只需交换样式表即可。对于使用一组不同的模板,是的,您只需要自定义,而不是编写自己的视图引擎。这非常简单,您所要做的就是告诉 MVC 在不同的位置查找您的视图:
http://www.dotnetguy.co.uk/post/2010/01/31/ASPNET- MVC-e28093-Dynamically-Changing-The-Master-Page-(Theming).aspx
MVC 插件小部件问题之前已被问过:
https://stackoverflow.com/questions/2230482/asp-net-mvc-2-widgets/2230833#2230833
Skinning isn't that hard, just swap stylesheets. For using a different set of templates, yes, you'd need just customize, not write your own, viewengine. This is pretty easy and all you'd have to do is tell MVC to look in different places for your views:
http://www.dotnetguy.co.uk/post/2010/01/31/ASPNET-MVC-e28093-Dynamically-Changing-The-Master-Page-(Theming).aspx
The MVC plugins widgets question has been asked before:
https://stackoverflow.com/questions/2230482/asp-net-mvc-2-widgets/2230833#2230833
我最终使用了 VirtualPathProvider,因为我想要应用程序外部的视图。现在,我们可以将视图存储在数据库中。
I ended up using a VirtualPathProvider since I wanted the views outside of the application. Now, we made it possible for the views to be stored in the database.