現在地
表示領域を追加する
ブロック表示領域(リージョン)を追加するカスタマイズを行います。
手順
1.template.phpの編集
- zen_regions 関数に広告表示用の領域 content_add を追加します。
function zen_regions() {
return array(
'left' => t('left sidebar'),
'right' => t('right sidebar'),
'content_top' => t('content top'),
'content_ad' => t('content ad'),
'content_bottom' => t('content bottom'),
'header' => t('header'),
'footer' => t('footer')
);
}
2.page.tpl.phpの編集 - 広告を表示したい場所1に以下のコードを追加します。
<?php if ($content_ad):?><div id="content-middle"><?php print $content_ad; ?></div><?php endif; ?>
3.管理者IDでログインし、ブロック管理画面で広告ブロックを新規に作成します。
4.作成した広告ブロックの表示領域を content ad に設定します。
上記変更内容の解説
- template.phpに <テーマ名>_regions 関数を定義し、その中で上記のように領域を追加定義する事で必要なだけブロック表示領域を作成する事が出来ます。初期状態の領域定義は、/themes/engines/phptemplate/phptemplate.engine ファイル内の phptemplate_regions 関数に定義されていますので、そちらからコピーしてくるとよいでしょう。