I am considering the StringTemplate view engine for my ASP.NET MVC application. This application will be built with one skin, but I then expect many more, often very similar skins to be developed for it. This is primiarly the reason for my choice of StringTemplate as the view engine, as there will be zero logic in the views.
In my head, I envisaged having each skin in a directory under the 'Views' directory in the folder structure, then maintaining a data structure which maps host开发者_如何学编程names to skin directories. An obvious disadvantage of this approach is that I will have to explicitly specify my view files - an alternative might be to hack the implementation of the View() method to change the /views/controller/action standard path and insert an extra layer.
Is anyone aware of any examples of implementations along these lines using ASP.NET MVC and StringTemplate at present? Can anyone forsee any potential problems with my approach?
Thanks in advance.
I have done something similar using nvelocity. I store all my pages and themes in the database and use an in memory instance of nvelocity to parse the content the parsed output is then cached under the domain key. I still use the the defat view engine for rendering but you could just as easily create a custom action result to render the result into the response stream.
This is how you can change the lookup path of views with the the default viewengine. Maybe it helps you.
Lookup View Path
精彩评论