2021.01.15
124
お疲れ様ですおっしーです。
メニューを増やしたいなーと思う事があると思います。
そんな時はデザイン画面>ブロックを新規追加 を押すのが普通ですよね。
何を今更?と仰るかと思いますが
user_data配下にtplを追加したくないの!って時は御座いませんか
そんな時は
data/任意のパス に自分で作成しちゃいましょー
例えで言えば
data/html/test/index.php
を作成
index.php の中身
// {{{ requires
require_once '../require.php';
require_once CLASS_EX_REALDIR. 'page_extends/test/LC_Page_Test_Ex.php';
// }}}
// {{{ generate page
$objPage = new LC_Page_Test_Ex();
register_shutdown_function(array($objPage, "destroy"));
$objPage->init();
$objPage->process();
か~ら~の~
data/class_extends/page_extends/test/LC_Page_Test_Ex.php を追加しますね~
// {{{ requires
require_once CLASS_EX_REALDIR . 'page_extends/LC_Page_Ex.php';
/**
* テスト のページクラス(拡張).
*
* LC_Page_Test_Ex をカスタマイズする場合はこのクラスを編集する.
*
* @package Page
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_Test_Ex.php
*/
class LC_Page_Test_Ex extends LC_Page_Ex{
// }}}
// {{{ functions
/**
* Page を初期化する.
*
* @return void
*/
function init() {
parent::init();
}
/**
* Page のプロセス.
*
* @return void
*/
function process() {
parent::process();
$this->action();
$this->sendResponse();
}
/**
* Page のAction.
*
* @return void
*/
function action() {
// 任意の処理
}
/**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}
}
こんな感じで書いていきます
親クラスはLC_Pageにしておきました。
後はdata/Smarty/test/index.tpl を作成し、html/test/ にアクセスすると
html/test/index.tplの中身が表示されません
え・・・!
というのもdtb_pagelayout にURLとファイル名の指定がないからです。
insert文を作成するが一番良いのですが
function init() {
parent::init();
$this->tpl_mainpage = 'test/index.tpl';
$this->tpl_subtitle= 'テスト';
}
これでも読み込めます。
やったね!
indexじゃなく他のtplを使い分けたいなと言う時は
function init() {
parent::init();
$this->tpl_mainpage = 'test/test.tpl';
$this->tpl_mainpage = 'テスト他のページ';
}
と書けばtest.tplが表示されます~
急ですがメモ帳を開いてF5を押してみてください。
日付が表示される。全く役に立たないですが何だか感動しました。