ブログトップ
マイページを表示する1
2014年03月31日
前回まででカートページの表示を説明しました。
今回はマイページの表示について見ていきます。


画面上部にあるマイページで表示される会員ログインページを例に見ていくと、
カートの時と同様にはじめてにURLを見ます。
会員ログインページのURLは/shop/user/loginになっていて、
/ショップID/マイページのURI/loginとなっています。
ページコントローラを見ると、
/soyshop/webapp/src/base/SOYShopSiteController.class.phpの48行目付近
//カートページ、もしくはマイページを開いた場合
if($doCartApplication || $doMypageApplication){
//カート マイページ 共通化
SOY2::import("component.backward.BackwardUserComponent");
SOY2::import("component.UserComponent");
//カート関連2
if($doCartApplication){
//カートページの表示は省略
}
//マイページ関連2
if($doMypageApplication){
//download_event
if(isset($_GET["soyshop_download"])){
$this->executeDownloadAction($_GET["soyshop_download"]);
exit;
}
$this->executeUserApplication($args);
return;
}
}
コードを見ると、カートページの表示と同様にexecuteUserApplicationを呼び出す。
このコードを確認すると、
/soyshop/webapp/src/base/SOYShopSiteController.class.phpの230行目付近
function executeUserApplication($args){
$webPage = SOY2HTMLFactory::createInstance("SOYShop_UserPage", array(
"arguments" => array(SOYSHOP_CURRENT_MYPAGE_ID, $args)
));
SOY2HTMLPlugin::addPlugin("src","SrcPlugin");
SOY2HTMLPlugin::addPlugin("display","DisplayPlugin");
SOYShopPlugin::load("soyshop.site.onload");
SOYShopPlugin::invoke("soyshop.site.onload", array("page" => $webPage));
$webPage->common_execute();
SOYShopPlugin::load("soyshop.site.beforeoutput");
SOYShopPlugin::invoke("soyshop.site.beforeoutput", array("page" => $webPage));
ob_start();
$webPage->display();
$html = ob_get_contents();
ob_end_clean();
SOYShopPlugin::load("soyshop.site.user.onoutput");
$delegate = SOYShopPlugin::invoke("soyshop.site.user.onoutput", array("html" => $html));
$html = $delegate->getHtml();
echo $html;
}
/soyshop/webapp/src/base/site/pages/SOYShop_UserPage.class.phpからWebPageオブジェクトを取得し、common_execute、displayと実行し、HTMLを出力して表示します。
カートページの表示と同様に細かい出し分けは
/soyshop/webapp/src/base/site/SOYShopPageBase.class.phpのcommon_executeで行われていますが、
それは次回に記載します。

