WYSIWYG維持 Flexy:start, Flexy:startchildren
変化しないところは別ファイルに。
通常startchildrenと併せて使います。
「テンプレートを分ける。」
真っ先に思いつくのは、
ヘッダー、フッターですな。
ヘッダーには<html><head><meta><body>などのお約束シリーズを、
フッターには</body></html>やコピーライトなどのこれまたお約束シリーズを。
たとえばこういう検索ページがあったとすると、
<?xml version="1.0" encoding="EUC-JP"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja"> <head> <title>検索</title> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body> <div class="search"> <h4>検索</h4> <input type="text" /><br /> <input type="radio" name="kind" id="kind[1]" /><span style="font-size:8px">タイトル</span><br /> <input type="radio" name="kind" id="kind[2]" /><span style="font-size:8px">本文</span><br /> <input type="radio" name="kind" id="kind[3]" /><span style="font-size:8px">名前</span><br /> <input type="submit" value="検索" /> </div> <div>Site admin: dozo</div> </body> </html>
ヘッダーとボディーとフッターにわける。
ヘッダー <?xml version="1.0" encoding="EUC-JP"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja"> <head> <title>検索</title> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body>
ボディ <div class="search"> <h4>検索</h4> <input type="text" /><br /> <input type="radio" name="kind" id="kind[1]" /><span style="font-size:8px">タイトル</span><br /> <input type="radio" name="kind" id="kind[2]" /><span style="font-size:8px">本文</span><br /> <input type="radio" name="kind" id="kind[3]" /><span style="font-size:8px">名前</span><br /> <input type="submit" value="検索" /> </div>
フッター <div>Site admin: dozo</div> </body> </html>
分け方はいろいろだと思うけど、こう分けるとすると、
テンプレートファイルはこうなります。
header.tpl <?xml version="1.0" encoding="EUC-JP"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja"> <head> <title>検索</title> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body>
body.tpl <flexy:include src="header.tpl" /> <div class="search"> <h4>検索</h4> <input type="text" /><br /> <input type="radio" name="kind" id="kind[1]" /><span style="font-size:8px">タイトル</span><br /> <input type="radio" name="kind" id="kind[2]" /><span style="font-size:8px">本文</span><br /> <input type="radio" name="kind" id="kind[3]" /><span style="font-size:8px">名前</span><br /> <input type="submit" value="検索" /> </div> <flexy:include src="footer.tpl" />
footer.tpl <div>Site admin: dozo</div> </body> </html>
ただ、これだとボディ部の見栄えが良くないので、
startchildrenと併用します。
WYSIWYG維持 Flexy:start, Flexy:startchildren