ちょっとしたメモ。

新版Moonyのはじめかた(localhostで開発する場合)。

<?php
require_once '/path/to/Moony.php';

$moony = new Moony();
$moony->actionDir = 'actions';
$moony->templateDir = 'templates';
$moony->start();
<?php
class Foo extends Moony_Action
{
    function execute()
    {
        $this->assign('message', 'Hello World');
        $this->render();
    }
}
  • templates/foo.phpを作成
<html>
<head></head>
<body>
<?php p($message); ?>
</body>
</html>

URLのindex.phpを省きたい場合はmod_rewriteを使えばOK。index.php/foo/bar にアクセスした場合、「bar」がexecuteメソッドの第一引数として渡される。