6.23 ウェブページのデザインをウェブページ別に切り替える

P.493

ウェブページの「キーワード」フィールドを利用して、レイアウトを切り替える

●ウェブページテンプレートの修正

2.ウェブページテンプレート編集画面のテンプレートの内容に、次の内容を設定します。

<mt:pageKeywords setvar="page_keywords" />
<mt:if name="page_keywords">
  <mt:include module="$page_keywords"$>
<mt:else>
  <mt:include module="デフォルトウェブページ"$>
</mt:if>

P.494

<mt:pageTitle setvar="page_title" />
<mt:include module="$page_title"$>

●「製品情報」ウェブページ用テンプレートモジュールの作成

テンプレート名:製品情報
テンプレートの内容:次の内容を設定

<mt:setVars>
title=<mt:pageTitle encode_html="1" />: <mt:blogName encode_html="1" />
body_onload=mtEntryOnLoad()
page_layout=layout-two-column-right
</mt:setVars>
<mt:include module="ヘッダー" />
<div id="contents" class="clearfix">
  <div id="main">
    <div class="content">
      <h2 class="entry-header"><mt:pageTitle encode_html="1" /></h2>
      <mt:include module="メタデータ" />
      <div class="entry-content clearfix">
      <mt:if tag="pageBody">
        <div class="entry-body"><mt:pageBody /></div>
      </mtif>
      <mt:if tag="pageMore">
        <div class="entry-more"><mt:pageMore /></div>
      </mt:if>
      </div>
      <mt:include module="コミュニケーション" />
    </div>
  <mt:include module="トラックバック" />
  <mt:include module="コメント" />
  </div>
  <div id="sub1">
    <mt:include module="サイドバー左" />
    <mt:include module="サイドバー右" />
  </div>
</div>
<mt:include module="フッター" />

P.495

<body class="layout-two-column-right" />

●「会社概要」ウェブページ用テンプレートモジュールの作成

テンプレート名:会社概要
テンプレートの内容:「製品情報」テンプレートの内容を設定して、004のみ、次の内容に変更

<mt:setVars>
title=<mt:pageTitle encode_html="1" />: <mt:blogName encode_html="1" />
body_onload=mtEntryOnLoad()
page_layout=layout-two-column-left
</mt:setVars>
...後略...
<body class="layout-two-column-left" />

他の情報でウェブページのデザインを切り替える

P.496

「ウェブページ」アーカイブテンプレート

<mt:pageExcerpt no_generate="1" setvar="page_excerpt" />
<mt:if name="page_excerpt">
  <mt:include module="$page_excerpt"$>
<mt:else>
  <mt:include module="デフォルトウェブページ"$>
</mt:if>

ウェブページ

Powered by Movable Type 4.261

このアーカイブについて

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。