[more of same thomashartman1@gmail.com**20080910131323] hunk ./templates/stringtemplate-basics.st 15 +
Note: +
Logged In? Let's see: $ loggedInUser $
+" Logged In? Let's see: $ loggedInUser $ "
hunk ./templates/templates-dont-repeat-yourself.st 20 -... Let's see: \$ loggedInUser \$
+" Logged In? Let's see: \$ loggedInUser \$ " hunk ./templates/templates-dont-repeat-yourself.st 22 -
Now, If you are running this tutorial locally, load up ghci by running ./hackInGhci
+Now, if you are running this tutorial locally, load up ghci by running ./hackInGhci
hunk ./templates/templates-dont-repeat-yourself.st 28 -*Main Misc View Text.StringTemplate> :t (directoryGroup :: String -> IO (STGroup String))
+(directoryGroup :: String -> IO (STGroup String)) :: String -> IO (STGroup String)
+
*Main Misc View Text.StringTemplate> :t renderTemplateGroup
+renderTemplateGroup :: STGroup String -> [(String, String)] -> String -> String
+
hunk ./templates/templates-dont-repeat-yourself.st 40
-
*Main> do templates <- directoryGroup "templates" ; writeFile "output.html" ( renderTemplateGroup templates [("loggedInUser","DarthVader")] "templates-dont-repeat-yourself" )
+
*Main Misc View Text.StringTemplate> do templates <- directoryGroup "templates" ; writeFile "output.html" ( renderTemplateGroup templates [("loggedInUser","DarthVader")] "templates-dont-repeat-yourself" ) hunk ./templates/templates-dont-repeat-yourself.st 46 -
*Main> do html <- tutlayout [("loggedInUser","DarthVader")] "templates-dont-repeat-yourself"; writeFile "output.html" html - +
*Main Misc View Text.StringTemplate> do html <- tutlayout [("loggedInUser","DarthVader")] "templates-dont-repeat-yourself"; writeFile "output.html" html hunk ./templates/templates-dont-repeat-yourself.st 52 -
It's not too much fun to develop this way, so the next thing you might want to try is actually +
You can get a sense for how this all works by looking at the tutlayout function in src/View.hs. + +
It's not too much fun to develop a web page by outputting a string to a static file and then opening +it in a browser every time something changes, so the next thing you might want to try is actually hunk ./templates/templates-dont-repeat-yourself.st 59 +$! hunk ./templates/templates-dont-repeat-yourself.st 66 +!$ hunk ./templates/templates-dont-repeat-yourself.st 68 -
You can get a sense for how this all works by looking at the tutlayout function in src/View.hs. - - - -
HAppS doesn't care much what templating system you use. -I use the TK HStringTemplate package to get the job done, so that's the syntax you're seeing. -We'll learn some StringTemplate basics next. +
HAppS doesn't care much what templating system you use. I use the +TK HStringTemplate package to get the job done, so +that's the syntax you've been seeing. We'll learn some +StringTemplate basics next.