
Untitled
By: a guest on
May 7th, 2012 | syntax:
None | size: 0.61 KB | hits: 16 | expires: Never
<?php
require 'straws.php';
class App extends Straws {
function get_index() {
$locals['test'] = "Hello world!";
return $this->render('page',$locals);
//return $this->render('page',array('test' => 'Hello world!')); ## also works
}
public function hello_name() {
$locals['greeting'] = "WHY";
if($params['name'] = "yo") {
$locals['greeting'] = "Welcome!";
}
return $this->render('hello',$locals);
}
}
$app = new App(array('template' => true)); // Options must be in an array
$app->get('/','get_index');
$app->get('/hello/:name/:age','hello_name');
$app->run();
?>