changeset 350:f356c4894d1b

working on TTView: layouts
author cin
date Mon, 07 Oct 2013 17:35:54 +0400
parents 86b470004d47
children cfd7570c2af2
files _test/Resources/view/layout/default.tt _test/Resources/view/layout/footer.tt _test/Resources/view/layout/header.tt _test/Resources/view/layout/menu.tt _test/Resources/view/layout/nav.tt _test/temp.pl
diffstat 6 files changed, 52 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/_test/Resources/view/layout/default.tt	Fri Oct 04 17:06:34 2013 +0400
+++ b/_test/Resources/view/layout/default.tt	Mon Oct 07 17:35:54 2013 +0400
@@ -1,4 +1,5 @@
 [% render('header') %]
 [% render('menu') %]
 [% render('nav') %]
+$content
 [% render('footer') %]
\ No newline at end of file
--- a/_test/Resources/view/layout/footer.tt	Fri Oct 04 17:06:34 2013 +0400
+++ b/_test/Resources/view/layout/footer.tt	Mon Oct 07 17:35:54 2013 +0400
@@ -0,0 +1,2 @@
+</body>
+</html>
\ No newline at end of file
--- a/_test/Resources/view/layout/header.tt	Fri Oct 04 17:06:34 2013 +0400
+++ b/_test/Resources/view/layout/header.tt	Mon Oct 07 17:35:54 2013 +0400
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>$document.title</title>
+</head>
+<body>
\ No newline at end of file
--- a/_test/Resources/view/layout/menu.tt	Fri Oct 04 17:06:34 2013 +0400
+++ b/_test/Resources/view/layout/menu.tt	Mon Oct 07 17:35:54 2013 +0400
@@ -0,0 +1,2 @@
+<div id="menu">
+</div>
\ No newline at end of file
--- a/_test/Resources/view/layout/nav.tt	Fri Oct 04 17:06:34 2013 +0400
+++ b/_test/Resources/view/layout/nav.tt	Mon Oct 07 17:35:54 2013 +0400
@@ -0,0 +1,2 @@
+<div id="nav">
+</div>
\ No newline at end of file
--- a/_test/temp.pl	Fri Oct 04 17:06:34 2013 +0400
+++ b/_test/temp.pl	Mon Oct 07 17:35:54 2013 +0400
@@ -12,31 +12,49 @@
 });
 
 print $ctx->invoke_environment(sub {
-	return shift->render(
-	    'product/view',{
-			model => {
-				name => 'debugger',
-				manufature => {
-					name => 'DEBUGGERS INC',
-					address => [
-					     {
-					     	coutry => 'Russuia',
-					     	city => 'Moscow'
-					     },
-					     {
-					     	country => 'GB',
-					     	city => 'Essex'
-					     }
-					]
-				}
-			}
-	   }
+	my ($this) = @_;
+	return $this->render(
+	    'default',
+	    {
+	    	content => sub {
+	    		return $this->invoke_environment(
+	    		    sub {
+		    			shift->render(
+			                'product/view',
+			                {
+					            model => {
+								    name => 'debugger',
+								    manufature => {
+										name => 'DEBUGGERS INC',
+										address => [
+										     {
+										     	coutry => 'Russuia',
+										     	city => 'Moscow'
+										     },
+										     {
+										     	country => 'GB',
+										     	city => 'Essex'
+										     }
+										]
+								    }
+					            }				            
+						    }
+						);
+		    		}, {
+		    			base => 'site'
+		    		}
+                );
+		    }
+	    }
     );
 }, {
-	base => 'site',
+	base => 'layout',
 	includes => [
 	   'packages'
 	],
-	tt_ext => 'tt'
+	tt_ext => 'tt',
+	document => {
+		title => 'Test document'
+	}
 });