Skip to content

Instantly share code, notes, and snippets.

@russ
Created February 24, 2011 18:30
Show Gist options
  • Save russ/842616 to your computer and use it in GitHub Desktop.
Save russ/842616 to your computer and use it in GitHub Desktop.
$r = new HydraRouter();
$r->dispatch("/", function() use ($env, $db) {
$result = $db->execute("SELECT (1 + 1) AS count");
$view = new HyrdaView("app/views/application.php");
list($header, $body) = $view->html(
"app/views/home.php",
array( "result" => $result ));
return array(200, array( $header ), $body);
});
$r->dispatch("/preview", function() use ($env) {
$view = new HyrdaView("app/views/application.php");
list($header, $body, $view->html(
"app/views/preview.php",
array( "time" => time() ));
return array(200, array( $header ), $body);
});
HydraDispatch::run($r);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment