Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.61 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.         require 'straws.php';
  3.         class App extends Straws {
  4.                 function get_index() {
  5.                         $locals['test'] = "Hello world!";
  6.                         return $this->render('page',$locals);
  7.                         //return $this->render('page',array('test' => 'Hello world!')); ## also works
  8.                 }
  9.                 public function hello_name() {
  10.                         $locals['greeting'] = "WHY";
  11.                         if($params['name'] = "yo") {
  12.                                 $locals['greeting'] = "Welcome!";
  13.                         }
  14.                         return $this->render('hello',$locals);
  15.                 }
  16.         }
  17.         $app = new App(array('template' => true)); // Options must be in an array
  18.         $app->get('/','get_index');
  19.         $app->get('/hello/:name/:age','hello_name');
  20.         $app->run();
  21. ?>