diff --git a/assets/.init.lua b/assets/.init.lua index 92904e8..4c5cc1d 100644 --- a/assets/.init.lua +++ b/assets/.init.lua @@ -1,4 +1,4 @@ --- LaunchBrowser() +LaunchBrowser() local migrate = require "migrate" @@ -10,10 +10,9 @@ db:exec("PRAGMA foreign_keys") migrate.migrate(db) fm = require "fullmoon" -fm.setTemplate("hello", "Hello, {%& name %}") +fm.setTemplate({"/tmpl/", tmpl = "fmt"}) fm.setRoute("/hello/:name", function(r) return fm.serveContent("hello", {name = r.params.name}) end) -fm.setTemplate("itworks", "

It works!

") -fm.setRoute("/", fm.serveContent("itworks")) +fm.setRoute("/", fm.serveContent("opendb")) fm.run() \ No newline at end of file diff --git a/assets/tmpl/layout.tmpl b/assets/tmpl/layout.tmpl new file mode 100644 index 0000000..a40a924 --- /dev/null +++ b/assets/tmpl/layout.tmpl @@ -0,0 +1,13 @@ + + + + Everything is Peachy + + + {% function block.pagebody() %} +

It works!

+

But something seems to be missing…

+ {% end %} + {% block.pagebody() %} + + \ No newline at end of file diff --git a/assets/tmpl/opendb.tmpl b/assets/tmpl/opendb.tmpl new file mode 100644 index 0000000..5eac089 --- /dev/null +++ b/assets/tmpl/opendb.tmpl @@ -0,0 +1,4 @@ +{% function block.pagebody() %} +

Please select a database file to load.

+{% end %} +{% render('layout') %} \ No newline at end of file