Shape to String or something....

Topics: General
Jan 6, 2013 at 2:24 PM
Edited Jan 6, 2013 at 4:28 PM

Help, please!

Need a to render a string by means of a Razor template (from shape probably) being on a driver content.

The following function: string RenderView(Controller controller, String viewName, object model) {}

requires a ControllerContext which I cannot get from a driver or don't know how.

Now I have to use WebClient to get the string from some controller - seems rather ugly ... but works

Does somebody know if is it possible to use the function or another being in the context of a content driver?

Developer
Jan 11, 2013 at 9:51 PM

Perhaps this project contains the code you need - it uses shapes (Razor templates) as a templating mechanism for email messages: https://bitbucket.org/bcarey/orchard.contrib.shapemessaging

Jan 12, 2013 at 11:41 AM

Great!

Thank  you very much, seems very promising!

Developer
Jan 12, 2013 at 11:48 AM

You're welcome. You may also be interested in RazorMachine, an open source project that enables you to process Razor templates in a standalone fashion (meaning that you can process Razor templates outside of a HTTP context). http://www.codeproject.com/Articles/423141/Razor-2-0-template-engine-supporting-layouts