/**
  * call an action file.
  * this shouldn't produce any output.
  * by convention, it should return some sort of data, usually an array
  * that can be consumed by the view
  * this is mapped into the view container.
  * if strict, trigger errors if the path isn't found.
  */
 public function execute($name, $strict = TRUE)
 {
     $path = \Gaia\ShortCircuit::resolver()->get($name, 'action');
     if (!$path) {
         if ($strict) {
             trigger_error('invalid action: ' . $name, E_USER_WARNING);
         }
         return;
     }
     return include $path;
 }
示例#2
0
 /**
  * Render a template
  */
 public function render($name, $strict = TRUE)
 {
     $path = \Gaia\ShortCircuit::resolver()->get($name, 'view');
     if (!$path) {
         if ($strict) {
             trigger_error('invalid view: ' . $name, E_USER_WARNING);
         }
         return;
     }
     include $path;
 }
<?php

include __DIR__ . '/../../common.php';
use Gaia\ShortCircuit;
use Gaia\ShortCircuit\Resolver;
use Gaia\ShortCircuit\PatternResolver;
$patterns = array('/go/(id)/' => 'nested/test', '/foo/bar/(a)/test/(b)' => 'nested/deep/test', '/idtest/(id)/' => 'id', '/lt/(a)/(b)/(c)' => 'linktest');
ShortCircuit::resolver(new Resolver(__DIR__ . '/../../shortcircuit/app/', $patterns));
ShortCircuit::run();