If you do something like this, it should render the page:
val htmlString:Box[String] = for{
r <- S.request
t <- Templates("index" :: Nil)
} yield S.render(t, r.request))
Where index
should be replaced by the path of the template you want to render. That should work for basic instances, but you'll need some additional work if you use Menu.params
or other URL type variables.
Update:
If you need to access session objects outside of the HTTP request thread, you will need to initialize the session. To do so, you could modify the above like so:
val html = for{
r <- S.request
sn <- S.session
t <- Templates("index" :: Nil)
} yield S.initIfUninitted(sn) {
S.render(t, r.request))
}