ちょっとしたメモ。
新版Moonyのはじめかた(localhostで開発する場合)。
- http://code.google.com/p/moony/ からコードをチェックアウト
- ApacheのDocumentRootにindex.phpを作成
<?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>
- http://localhost/index.php/foo にアクセス。「Hello World」と表示される
URLのindex.phpを省きたい場合はmod_rewriteを使えばOK。index.php/foo/bar にアクセスした場合、「bar」がexecuteメソッドの第一引数として渡される。