EC-CUBE2.13系のブロック・ページ作成(2.12系からの変更)

この記事のインデックス

———-

(1)ブロック

① コールPHP ■html/frontparts/bloc/●●.php

<?php
require_once realpath(dirname(__FILE__)) . '/../../require.php';
require_once CLASS_EX_REALDIR . 'page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_○○_Ex.php';

$objPage = new LC_Page_FrontParts_BLoc_○○_Ex();
$objPage->blocItems = $params['items'];
$objPage->init();
$objPage->process();

★register_shutdown_function(array($objPage, “destroy”)); ←削除

② 拡張クラス ■data/class_extends/page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_○○_Ex.php

<?php
require_once CLASS_REALDIR . 'pages/frontparts/bloc/LC_Page_FrontParts_Bloc_○○.php';

class LC_Page_FrontParts_Bloc_○○_Ex extends LC_Page_FrontParts_Bloc_○○
{
/**
* Page を初期化する.
*
* @return void
*/
function init()
{
parent::init();
}

/**
* Page のプロセス.
*
* @return void
*/
function process()
{
parent::process();
}
}


★以下削除

/**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}

③ ページクラス ■data/class/page/frontparts/bloc/LC_Page_FrontParts_Bloc_○○_.php

<?php
require_once CLASS_EX_REALDIR . 'page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Ex.php';

class LC_Page_FrontParts_Bloc_○○ extends LC_Page_FrontParts_Bloc_Ex
{
/**
* Page を初期化する.
*
* @return void
*/
public function init()
{
parent::init();
// include_phpで、読み込ませるために必要な記述
$this->setTplMainpage('fontsize.tpl');
}

/**
* Page のプロセス.
*
* @return void
*/
public function process()
{
$this->action();
$this->sendResponse();
}

/**
* Page のアクション.
*
* @return void
*/
public function action()
{

}
}


require_once CLASS_REALDIR . ‘pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php';
↓【変更】
require_once CLASS_EX_REALDIR . ‘page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Ex.php';


class LC_Page_FrontParts_Bloc_○○ extends LC_Page_FrontParts_Bloc {
↓【変更】
class LC_Page_FrontParts_Bloc_○○ extends LC_Page_FrontParts_Bloc_Ex
{


function init()
↓【変更】
public function init()


function process()
↓【変更】
public function process()


function action()
↓【変更】
public function action()

★以下削除

*    /**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}

(2)ページ

① コールPHP

require_once '../require.php';
require_once CLASS_EX_REALDIR . 'page_extends/abouts/LC_Page_○○_Ex.php';

$objPage = new LC_Page_Abouts_Ex();
$objPage->init();
$objPage->process();

★register_shutdown_function(array($objPage, “destroy”)); ←削除

② 拡張クラス

<?php
require_once CLASS_REALDIR . 'pages/abouts/LC_Page_○○.php';

class LC_Page_Postage_Ex extends LC_Page_Postage
{
/**
* Page を初期化する.
*
* @return void
*/
function init()
{
parent::init();
}

/**
* Page のプロセス.
*
* @return void
*/
function process()
{
parent::process();
}
}

★下記削除

/**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}

③ ページクラス

<?php
require_once CLASS_EX_REALDIR . 'page_extends/LC_Page_Ex.php';

class LC_Page_○○ extends LC_Page_Ex
{
/**
* Page を初期化する.
*
* @return void
*/
public function init()
{
parent::init();
$this->tpl_title = '□□□□□';
}

/**
* Page のプロセス.
*
* @return void
*/
public function process()
{
parent::process();
$this->action();
$this->sendResponse();
}

/**
* Page のアクション.
*
* @return void
*/
public function action()
{
}
}


function init()
↓【変更】
public function init()


function process()
↓【変更】
public function process()


function action()
↓【変更】
public function action()

★以下削除

*    /**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}