Ejemplo n.º 1
0
function view($templateFile, $args = [])
{
    $app = App::getApp();
    $template = $app->twig->loadTemplate($templateFile);
    return $template->render($args);
}
Ejemplo n.º 2
0
Archivo: View.php Proyecto: xt9/tunnel
 public function __construct()
 {
     $this->app = App::getApp();
 }
Ejemplo n.º 3
0
 public function test_singleton()
 {
     $this->assertInstanceOf('\\Tunnel\\Core\\Application', $this->app);
     $app2 = App::getApp();
     $this->assertEquals($app2, $this->app);
 }
Ejemplo n.º 4
0
<?php

use Tunnel\Core\Application as App;
use Tunnel\Router\Router;
use Tunnel\View\View;
use Tunnel\Helpers\UrlHelper;
use Carbon\Carbon;
// Define paths
define('ROOT_PATH', realpath('../'));
define('APP_PATH', ROOT_PATH . '/app');
define('WEBROOT_PATH', ROOT_PATH . '/public');
define('VENDOR_PATH', ROOT_PATH . '/vendor');
define('FRAMEWORK_PATH', ROOT_PATH . '/framework');
// Autoload stuff & get config var
require_once VENDOR_PATH . '/autoload.php';
require_once FRAMEWORK_PATH . '/src/Globals.php';
$config = (require_once APP_PATH . '/config.php');
// Create our application object
$app = App::getApp();
$app->setConfig($config);
$app->boot();
/* Register our modules */
$app->bind('router', new Router('404.html'));
$app->bind('view', new View());
$app->bind('url', new UrlHelper());
$app->bind('date', new Carbon());