base.dwtで生成した普通のindex.htmlはあるのに、
/Templates/base.dwtを紛失してしまった、というトラブルに見舞われたら・・・。
index.htmlを別名保存します 例:base.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"><!-- InstanceBegin template="/Templates/base.dwt" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <!-- InstanceBeginEditable name="doctitle" --> <title></title> <!-- InstanceEndEditable --> <link href="../common/css/style.css" rel="stylesheet" type="text/css" media="screen,print,TV" /> <!-- InstanceParam name="body_id" type="text" value="index" --><!-- InstanceParam name="body_class" type="text" value="body_index" --> <!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --> </head><body id="index" class="body_index">
<!-- InstanceBeginEditable name="contents" -->
<!-- InstanceEndEditable --></body>
<!-- InstanceEnd --></html>
「Instance」を「Template」に置換
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"><!-- TemplateBegin template="/Templates/base.dwt" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <!-- TemplateBeginEditable name="doctitle" --> <title></title> <!-- TemplateEndEditable --> <link href="../common/css/style.css" rel="stylesheet" type="text/css" media="screen,print,TV" /> <!-- TemplateParam name="body_id" type="text" value="index" --><!-- TemplateParam name="body_class" type="text" value="body_index" --> <!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable --> </head><body id="index" class="body_index">
<!-- TemplateBeginEditable name="contents" -->
<!-- TemplateEndEditable --></body>
<!-- TemplateEnd --></html>
先頭の記述と、最下部の記述をトル
<!-- InstanceBegin template="/Templates/base.dwt" codeOutsideHTMLIsLocked="false" --> <!-- InstanceEnd --> 上記2個を削除属性を編集可能領域にしている場合は、それを書き換える
前 <body id="index" class="body_index">後
<body id="@@(body_id)@@" class="@@(_document['body_class'])@@">
オプション領域を使っている場合は、、、(保留)
/Templates/base.dwtとして保存
テストする
ためしに、テスト的にhtmlを開き、 修正>テンプレート>現在のページを更新 をしてみる。テンプレートエラーや、
更新をする前と、した後で、問題のある差異が生じたら、成功とはいえません。(winMergeとかで確認してみましょう)
特に何も変化がなければ、復元成功、というわけですね。
また、ガンガン一括編集できますよ。
出来上がりは、こんな感じ。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<!-- TemplateBeginEditable name="doctitle" -->
<title></title>
<!-- TemplateEndEditable -->
<link href="../common/css/style.css" rel="stylesheet" type="text/css" media="screen,print,TV" />
<!-- TemplateParam name="body_id" type="text" value="index" --><!-- TemplateParam name="body_class" type="text" value="body_index" -->
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
</head><body id="@@(body_id)@@" class="@@(_document['body_class'])@@">
<!-- TemplateBeginEditable name="contents" -->
<!-- TemplateEndEditable --></body>
</html>