OSDN Git Service

- newly implemented layout template.
authormumumu-org <mumumu-org@2ef88817-412d-0410-a32c-8029a115e976>
Sun, 26 Apr 2009 04:38:26 +0000 (04:38 +0000)
committermumumu-org <mumumu-org@2ef88817-412d-0410-a32c-8029a115e976>
Sun, 26 Apr 2009 04:38:26 +0000 (04:38 +0000)
Idea_Extended_ViewClass/CHANGES
Idea_Extended_ViewClass/class/Plugin/Generator/Ethna_Plugin_Generator_Project.php
Idea_Extended_ViewClass/skel/template.index.tpl
Idea_Extended_ViewClass/skel/template.layout.tpl [new file with mode: 0644]

index c0ec9da..6672c41 100644 (file)
@@ -8,7 +8,17 @@
 -- Ethna_ActionClass から、Ethna_ViewClass#preforward に引数を渡せるようにした
 --- return array('forward_name', $params); の形式で渡せば、$params が preforwardの引数として渡される
 -- 汎用ビュークラスを実装
+--- ビューへの出力時によく使われる処理を雛形として実装したもの
 --- Ethna_View_Json.php
+--- Ethna_View_404.php
+--- Ethna_View_500.php
+--- Ethna_View_Redirect.php
+---- アクションクラスで return array('redirect', 'http://example.com');
+     とすれば http://example.com にリダイレクトされる
+-- レイアウトテンプレートを実装
+--- HTMLの外側に当たる雛形のテンプレートを描くためのもの。各アクションの出力はこのテンプレートの出力でラップされる
+--- デフォルトは template/{locale_name/layout.tpl に置かれている。
+--- この機能はデフォルトで有効になっている。無効にしたければ、[appid]_ViewClass.php の $use_layout を false にする
 
 *** bug fix
 
index f0f02b8..1bc4412 100644 (file)
@@ -153,6 +153,9 @@ class Ethna_Plugin_Generator_Project extends Ethna_Plugin_Generator
             "app.url_handler.php" => sprintf("$basedir/app/%s_UrlHandler.php", $macro['project_id']),
             "etc.ini.php" => sprintf("$basedir/etc/%s-ini.php", $macro['project_prefix']),
             "template.index.tpl" => sprintf("$basedir/template/$locale/index.tpl"),
+            "template.layout.tpl" => sprintf("$basedir/template/$locale/layout.tpl"),
+            "template.404.tpl" => sprintf("$basedir/template/$locale/404.tpl"),
+            "template.500.tpl" => sprintf("$basedir/template/$locale/500.tpl"),
         );
 
         $skelfile_maps = array(
index cece182..b6410c1 100644 (file)
@@ -1,11 +1,3 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset={$client_enc}" />
-<link rel="stylesheet" href="{$config.url}css/ethna.css" type="text/css" />
-</head>
-<body>
-
 <div id="header">
     <h1>{$project_id}</h1>
 </div>
@@ -18,6 +10,3 @@
 <div id="footer">
     Powered By <a href="http://ethna.jp">Ethna</a>-{$smarty.const.ETHNA_VERSION}.
 </div>
-
-</body>
-</html>
diff --git a/Idea_Extended_ViewClass/skel/template.layout.tpl b/Idea_Extended_ViewClass/skel/template.layout.tpl
new file mode 100644 (file)
index 0000000..64ec999
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset={$client_enc}" />
+<link rel="stylesheet" href="{$config.url}css/ethna.css" type="text/css" />
+</head>
+<body>
+{$content}
+</body>
+</html>