0

Which's the equivalent for

...
import Happstack.Server.Heist

pageHeist :: B.ByteString -> [(T.Text,T.Text)] -> ServerPart Response
kfzPaginaHeist template par = do
       pagina <- newTemplateDirectory' "template" $ bindStrings par defaultHeistState       
       render pagina template

with the new heist api? Also, did the and (or the way you're supposed to load templates) change?

Hai
  • 4,764
  • 8
  • 29
  • 26

1 Answers1

2

First of all, you probably don't want to call newTemplateDirectory in the ServerPart monad. It should be called when your application starts up. Second, instead of passing it a HeistState, now you pass it a HeistConfig which contains all of your splices.

mightybyte
  • 7,282
  • 3
  • 23
  • 39
  • yes, happstack uses heist.compiled so should I use compiled splices? And if yes, I have to pass hcCompiledSplices and hcTemplates int the HeistConfig? – Hai Mar 18 '13 at 11:47
  • Yes, and yes. You can also pass in interpreted splices if you want. They just won't be used. – mightybyte Mar 18 '13 at 17:58
  • I changed it to http://hpaste.org/84284. The splices work correctly, but all and don't work anymore (template applied:http://goo.gl/YnjNq and with apply: http://goo.gl/ktgFL ). Could you please tell me why? – Hai Mar 18 '13 at 23:23
  • You have to add those splices as well. They are you supplied for you in [this list](http://hackage.haskell.org/packages/archive/heist/0.11.1/doc/html/Heist.html#v:defaultInterpretedSplices). – mightybyte Mar 19 '13 at 14:04
  • Thank you! Now everything is fine – Hai Mar 19 '13 at 22:22