summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-06-16 17:33:41 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-06-16 17:33:41 +0200
commitae5cd024e07960002f4f9bbae23b6ccb3b73b3eb (patch)
tree8281cd099d7d95ae35fd51cbfc8375834525b514 /examples
parent9afeb6e5a87e50eef1c87844e1c2923cc2680f73 (diff)
downloadzorglub-ae5cd024e07960002f4f9bbae23b6ccb3b73b3eb.zip
zorglub-ae5cd024e07960002f4f9bbae23b6ccb3b73b3eb.tar.gz
enable view and layout usage
Diffstat (limited to 'examples')
-rw-r--r--examples/sample.ru17
1 files changed, 11 insertions, 6 deletions
diff --git a/examples/sample.ru b/examples/sample.ru
index b318f86..009eaae 100644
--- a/examples/sample.ru
+++ b/examples/sample.ru
@@ -4,14 +4,19 @@ $LOAD_PATH << File.join(File.dirname( File.absolute_path(__FILE__)), '..', 'lib'
#
require 'zorglub'
#
-Zorglub::Config.register_engine 'my-engine', 'my-ext'
-Zorglub::Config.register_engine 'temp-engine', 'tmp'
+require 'haml'
+HAML_PROC = Proc.new { |path,obj| Haml::Engine.new( File.open(path,'r').read ).render(obj) }
+Zorglub::Config.register_engine 'haml', 'haml', HAML_PROC
+Zorglub::Config.register_engine 'temp-engine', 'haml', HAML_PROC
+#
+Zorglub::Config.engine = 'haml'
Zorglub::Config.root = File.dirname( File.absolute_path(__FILE__) )
#
class Node1 < Zorglub::Node
#
def index a1, *a2
- "<title>Node1:index</title><p>a1 : #{a1.inspect}</p><p>a2 : #{a2.inspect}</p>#{html}"
+ @title='Node2'
+ #"<title>Node1:index</title><p>a1 : #{a1.inspect}</p><p>a2 : #{a2.inspect}</p>#{html}"
end
#
def alt *args
@@ -27,11 +32,11 @@ end
class Node2 < Zorglub::Node
#
map APP, '/url2'
- engine 'my-engine'
- layout 'my-layout'
+ engine 'my-engine' # not available
+ layout 'my-layout' # not available
#
def index *args
- "<title>Node2</title>#{html}"
+ "<title>Node2:alt</title>#{html}"
end
#
def alt *args