$URL = array_shift($URL_PARTS); if (false === strpos($URL, '.')) { $FORMAT = 'html'; } else { $FORMAT = array_pop($URL_PARTS); } break; } } if (!isset($URL)) { $FILE = '404.php'; $URL = $_GET['__url__']; $URL_PARTS = array(); $FORMAT = 'html'; } unset($routes); unset($pattern); unset($_GET['__url__']); Sd('FILE', $FILE); Sd('URL', $URL); Sd('URL_PARTS', $URL_PARTS); Sd('FORMAT', $FORMAT); # Dispatch # Beyond the superglobals, these are passed to the called file: # FILE: the name of the file included to handle the request # URL: the complete request URL, minus the query string # URL_PARTS: array of matched sub-patterns in the URL # FORMAT: one (html|xml|json|rss|rdf|php) for determining output format require_once $FILE; Sout(Sl(reset(explode('.', $FILE)) . '.' . $FORMAT . '.php'));
<?php return html(head(meta(array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8')), meta(array('id' => 'viewport', 'name' => 'viewport', 'content' => 'width=320; initial-scale=1.0; ' . 'maximum-scale=1.0; user-scalable=0;')), title(Sc('title'), Sd('title'), ' — Where’s my car?'), title(Sc('title', false), 'Where’s my car?'), S('link', array(array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => '/css/style.css')))), body(div(array('id' => 'head'), a(array('href' => '/'), 'Where’s my car?')), div(array('id' => 'content'), h1(Sc('title'), Sd('title')), p(array('class' => 'error'), Sc('error'), Sd('error')), p(array('class' => 'status'), Sc('status'), Sd('status')), p(array('class' => 'success'), Sc('success'), Sd('success')), Sl()), div(array('id' => 'foot'), p(Sc('logged_in'), a(array('href' => '/logout'), 'Logout')), p('By ', a(array('href' => 'http://rcrowley.org/'), 'Richard Crowley')))));