ECCUBE のヘッダ画像を切り替える方法メモ

このページを参考にした。
http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=5658&forum=10&post_id=27231

使用ファイル
header○○.tpl を必要枚数
main.css
/data/ec/Smarty/templates/defaultsite_main.tpl
/data/ec/class/SC_View.php


はてな では <!----> が非表示になってしまう為 わざと全角<>を使用しています。
 

まず

/data/ec/Smarty/templates/defaultsite_main.tpl

<!--{* ▼HEADER *}-->
<!--{if $arrPageLayout.header_chk != 2}-->
<!--{include file= $header_tpl}-->
<!--{/if}-->
<!--{* ▲HEADER *}-->


<!--{* ▼HEADER *}-->
<!--{ if $smarty.server.REQUEST_URI=="/ec/user_data/takumi.php"}-->
<!--{include file= $header_tpl}-->
<!--{ elseif $smarty.server.REQUEST_URI=="/ec/mypage/login.php"}-->
<!--{include file= $header4_tpl}-->
<!--{ elseif $smarty.server.REQUEST_URI=="/ec/products/detail.php?product_id=38"}-->
<!--{include file= $header38_tpl}-->



<!--{else}-->
<!--{include file= $header3_tpl}-->
<!--{/if}-->
<!--{* ▲HEADER *}-->





こんな感じに変更。

ここで if文 を覚えた。

if文による条件分岐【PHP入門】-----------------------------------------

if (条件) {
条件に一致した場合に実行するプログラム
} else {
条件に一致しなかった場合に実行するプログラム
}

条件の複数指定
if (条件1) {
条件1に一致した場合に実行するプログラム
} elseif (条件2) {
条件1に一致せず、条件2に一致した場合に実行するプログラム
} else {
条件1と条件2の両方に一致しなかった場合に実行するプログラム
}

                                                                                                                                          • -

とのこと、複数の条件分岐をする際に elseif を使い条件を追加していくらしい。


その後、
/data/ec/class/SC_View.php の


SC_View.php 97行目あたり


// ヘッダとフッタを割り当て
$header_tpl = USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . "header.tpl";
$footer_tpl = USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . "footer.tpl";


$header2_tpl = USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . "header2.tpl";
$header3_tpl = USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . "header3.tpl";



を追加。



110行目あたりの


$this->assign("header_tpl", $header_tpl);
$this->assign("footer_tpl", $footer_tpl);


$this->assign("header2_tpl", $header2_tpl);
$this->assign("header3_tpl", $header3_tpl);



を追加。


その後、header○○.tpl を 必要枚数作成。

そして main.css に header○○.tpl 毎のCSSを記述し、画像の指定などを行い
アップロードして完成。





 -------------------------------------------------------------------
ECCUBEの新着情報に画像を表示したい
下記ページを参考にしました、ありがとうです。
http://12net.jp/blog/b20100519_01.html