ダウンロードしてみる

日記も読み終わったことだしダウンロードしてみる。
何も考えず example1.php を実行してみるも、Smarty のファイルが無いと言われる。
しょんぼり。


HPのインストールの項目を見てみる。手順が逆だが…。
Smarty は必須なのね。。
しょんぼり。


動作サンプルはMapleのHPにあるのでそれを見ればいいか。
取り敢えず example1.php について順にたどってみよう。


example1.php

require_once "../webapp/config/maple.inc.php";

設定ファイルが読み込まれる。


ここでは書くディレクトリの設定や include_path に maple ディレクトリを設定している。
そしてコントローラクラスの読込。

require_once 'core/Controller.class.php';

そして戻ってきて
example1.php

$controller =& new Controller();
$controller->execute();


コントローラでは LogFactory クラスの生成、DIContainer の生成、DIconからリクエストパラメータの取得、アクションの決定、アクションチェーンの設定、そしてアクションチェーンのループに入る。

$log =& LogFactory::getLog();
$container =& Controller::_createDIContainer();

$request =& $container->getComponent("Request");
$request->dispatchAction();
$actionName = $request->getParameter(ACTION_KEY);

$actionChain =& $container->getComponent("ActionChain");
$actionChain->add($actionName);

while ($actionChain->hasNext()) {
    $actionChain->next();
}

while の中では、設定ファイルの読込、フィルタチェーンの実行、設定ファイルのクリア、その後次のアクションに移る。



素朴な疑問がひとつ。

class Sample{
    function &Sample{
    }
}

$sample = & new Sample();

& ってどこにつければいいんだろ?
function のところにも new の後にもついてるのって、直感的に変な感じ。
そもそも $class = & new Class() っていうPHP4の書き方が変なんだよね。