Created
February 24, 2011 18:30
-
-
Save russ/842616 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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