Perfect.. You saved my day.I've been poking around the MR code to see how it
calls the TemplateEngine, that's how I ended up with the NVelocityViewEngine
:)

greetings Daniel

On Fri, Oct 16, 2009 at 11:24 PM, John Simons <[email protected]>wrote:

>
> That is what TemplateEngine Component is for.
> Have a look at
> http://www.castleproject.org/components/templateengine/index.html
>
> On Oct 17, 8:18 am, Mauricio Scheffer <[email protected]>
> wrote:
> > If you're out of Monorail I wouldn't use anything that belongs to
> > Monorail, like NVelocityViewEngine.
> > Instead, just use NVelocity's VelocityEngine. Some samples:
> >
> >
> http://code.google.com/p/mausch/source/browse/trunk/StringInterpolati...http://code.google.com/p/mausch/source/browse/trunk/WebMonitor/WebMon.
> ..
> >
> > On Oct 16, 5:28 pm, Daniel Hölbling <[email protected]> wrote:
> >
> > > Hi guys.I'm running a MonoRail application. But there is one
> HTTPHandler
> > > that is running outside of MR, yet i'd still like to render a NVelocity
> > > template as output.
> >
> > > First I tried the obvious:
> >
> > > var locator = new EngineContextLocator();
> > > IEngineContext context = locator.LocateCurrentContext();
> > > var writer = new StringWriter();
> > > if (context.Services.ViewEngineManager.HasTemplate("elms-login"))
> > > {
> > >     context.Services.ViewEngineManager.Process("elms-lgin", "default",
> > > writer, null);
> >
> > > }
> >
> > > return writer.ToString();
> >
> > > But the locator can't find a EngineContext, so I don't get access to
> the
> > > ViewEngineManager :(
> >
> > > Now I changed the code slightly trying to directly access the NV
> ViewEngine:
> >
> > >         public string GetTemplate(string templateName)
> > >         {
> > >             var engine = new NVelocityViewEngine();
> > >             engine.Initialize();
> >
> > >             var writer = new StringWriter();
> > >             engine.Process("elms-login", "default", writer, null);
> >
> > >             return writer.ToString();
> > >         }
> >
> > > This also doesn't work since the ViewSourceLoader is not set properly,
> since
> > > it's protected I can't set it to something.
> >
> > > Any ideas on how to get NV to render my template without MR?
> >
> > > greetings Daniel
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to