Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

bootstrap.php returns DI container and index.php runs the application

  • Loading branch information...
commit 2ed0be188e3b28e77a39924058706ed4e2494698 1 parent 64a69e1
@dg dg authored
View
6 CD-collection/app/bootstrap.php
@@ -5,12 +5,13 @@
// Load Nette Framework or autoloader generated by Composer
-require LIBS_DIR . '/autoload.php';
+require __DIR__ . '/../libs/autoload.php';
// Configure application
$configurator = new Nette\Config\Configurator;
// Enable Nette Debugger for error visualisation & logging
+//$configurator->setDebugMode(TRUE);
$configurator->enableDebugger(__DIR__ . '/../log');
// Enable RobotLoader - this will load all classes automatically
@@ -32,5 +33,4 @@
$container->router = new SimpleRouter('Dashboard:default');
}
-// Run the application!
-$container->application->run();
+return $container;
View
14 CD-collection/www/index.php
@@ -1,13 +1,7 @@
<?php
-// absolute filesystem path to this web root
-define('WWW_DIR', __DIR__);
+// let bootstrap create Dependency Injection container
+$container = require __DIR__ . '/../app/bootstrap.php';
-// absolute filesystem path to the application root
-define('APP_DIR', WWW_DIR . '/../app');
-
-// absolute filesystem path to the libraries
-define('LIBS_DIR', WWW_DIR . '/../libs');
-
-// load bootstrap file
-require APP_DIR . '/bootstrap.php';
+// run application
+$container->application->run();
View
6 Fifteen/app/bootstrap.php
@@ -4,12 +4,13 @@
// Load Nette Framework or autoloader generated by Composer
-require LIBS_DIR . '/autoload.php';
+require __DIR__ . '/../libs/autoload.php';
// Configure application
$configurator = new Nette\Config\Configurator;
// Enable Nette Debugger for error visualisation & logging
+//$configurator->setDebugMode(TRUE);
$configurator->enableDebugger(__DIR__ . '/../log');
// Enable RobotLoader - this will load all classes automatically
@@ -24,5 +25,4 @@
// Setup router
$container->router = new SimpleRouter('Default:default');
-// Run the application!
-$container->application->run();
+return $container;
View
14 Fifteen/www/index.php
@@ -1,13 +1,7 @@
<?php
-// absolute filesystem path to this web root
-define('WWW_DIR', __DIR__);
+// let bootstrap create Dependency Injection container
+$container = require __DIR__ . '/../app/bootstrap.php';
-// absolute filesystem path to the application root
-define('APP_DIR', WWW_DIR . '/../app');
-
-// absolute filesystem path to the libraries
-define('LIBS_DIR', WWW_DIR . '/../libs');
-
-// load bootstrap file
-require APP_DIR . '/bootstrap.php';
+// run application
+$container->application->run();
View
6 Modules-Usage/app/bootstrap.php
@@ -6,12 +6,13 @@
// Load Nette Framework or autoloader generated by Composer
-require LIBS_DIR . '/autoload.php';
+require __DIR__ . '/../libs/autoload.php';
// Configure application
$configurator = new Nette\Config\Configurator;
// Enable Nette Debugger for error visualisation & logging
+//$configurator->setDebugMode(TRUE);
$configurator->enableDebugger(__DIR__ . '/../log');
// Enable RobotLoader - this will load all classes automatically
@@ -38,5 +39,4 @@
$container->router = new SimpleRouter('Front:Default:default');
}
-// Run the application!
-$container->application->run();
+return $container;
View
2  Modules-Usage/app/presenters/BasePresenter.php
@@ -7,7 +7,7 @@
protected function beforeRender()
{
$this->template->viewName = $this->view;
- $this->template->root = dirname(realpath(APP_DIR));
+ $this->template->root = isset($_SERVER['SCRIPT_FILENAME']) ? realpath(dirname(dirname($_SERVER['SCRIPT_FILENAME']))) : NULL;
$a = strrpos($this->name, ':');
if ($a === FALSE) {
View
14 Modules-Usage/www/index.php
@@ -1,13 +1,7 @@
<?php
-// absolute filesystem path to this web root
-define('WWW_DIR', __DIR__);
+// let bootstrap create Dependency Injection container
+$container = require __DIR__ . '/../app/bootstrap.php';
-// absolute filesystem path to the application root
-define('APP_DIR', WWW_DIR . '/../app');
-
-// absolute filesystem path to the libraries
-define('LIBS_DIR', WWW_DIR . '/../libs');
-
-// load bootstrap file
-require APP_DIR . '/bootstrap.php';
+// run application
+$container->application->run();
Please sign in to comment.
Something went wrong with that request. Please try again.