<?php require_once '__init__.php'; Rhaco::import('generic.Urls'); Rhaco::import('model.Todo'); Rhaco::import('model.Category'); $db = new DbUtil(Category::connection()); $patterns = array('^$' => array('class' => 'generic.Views', 'method' => 'read', 'args' => array(new Todo(), new C(Q::eq(Todo::columnClose(), false), Q::fact())), 'template' => 'list.html'), '^detail/(\\d+)$' => array('method' => 'detail', 'args' => array(new Todo(), new C(Q::fact()))), '^create$' => array('method' => 'create', 'args' => array(new Todo(), Rhaco::url())), '^update/(\\d+)$' => array('method' => 'update', 'args' => array(new Todo(), null, Rhaco::url())), '^delete/(\\d+)$' => array('method' => 'delete', 'args' => array(new Todo(), null, Rhaco::url())), '^cat/(\\d+)$' => array('method' => 'detail', 'args' => array(new Category(), new C(Q::depend())))); $parser = Urls::parser($patterns, $db); $parser->setVariable('categories', $db->select(new Category())); $parser->write();
<?php require dirname(__FILE__) . '/__init__.php'; Rhaco::import('tag.HtmlParser'); $db = new DbUtil(Event::connection()); $p = new HtmlParser('index.html'); $p->setVariable('event', $db->get(new Event(), new C(Q::depend(), Q::eq(Event::columnId(), Rhaco::constant('CURRENT_EVENT', 1))))); $p->setVariable('hatena', Rhaco::obj('HatenaSyntax', array('headlevel' => 4, 'id' => 'event_description'))); $p->write();