예제 #1
0
 public function __construct(LayerInterface $next = null, array $config = [], array $env = [])
 {
     parent::__construct($next, $config, $env);
     $this->map(array('pattern' => '*', 'fn' => function ($req, $res) {
         $res->write($this->master->getHeader());
         $res->write($this->master->getMenuHtml());
         $res->write('<div class="article"><div class="article-header"><h1>Blog</h1></div>');
         $res->write($this->master->getFooter());
     }));
 }
예제 #2
0
 public function __construct(LayerInterface $next = null, array $config = [], array $env = [])
 {
     parent::__construct($next, $config, $env);
     $this->map(array('pattern' => '/', 'fn' => function ($req, $res) {
         $pageTitle = 'Welcome to ' . $this->master->config['title'] . '!';
         $res->write($this->master->getHeader());
         $res->write($this->master->getMenuHtml());
         $res->write('<div class="article"><div class="article-header"><h1>' . $pageTitle . '</h1></div></div>');
         $res->write($this->master->getFooter());
     }));
     $this->map(array('pattern' => '*', 'fn' => function ($req, $res) {
         $pageTitle = '404 — Not Found';
         $res->write($this->master->getHeader($pageTitle));
         $res->write($this->master->getMenuHtml());
         $res->write('<div class="article"><div class="article-header"><h1>' . $pageTitle . '</h1></div></div>');
         $res->write($this->master->getFooter());
     }));
 }
예제 #3
0
 public function testGetRealPath()
 {
     $app = new Module(null, array('basePath' => '/foo'), array('REQUEST_URI' => '/foo/test'));
     $this->assertEquals('/foo/bar', $app->getRealPath('bar'));
 }