note 107028 modified in yaf-dispatcher.getapplication by danbrown
| From: | danbrown@php.net | Date: | Tue, 03 Jan 2012 21:50:03 +0000 |
| Subject: | note 107028 modified in yaf-dispatcher.getapplication by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-185294@lists.php.net to get a copy of this message | ||
Here is an example of how you can get the instance of Yaf_Application from somewhere in your
application.
index.php:
<?php
// Set BASE_PATH to one directory up, outside of document root
define('BASE_PATH', realpath(dirname(__FILE__) . '/..'));
// Instantiate new application
$app = new Yaf_Application(BASE_PATH . '/application/config/application.ini');
$app->bootstrap()->run();
?>
Blog.php (controller):
<?php
$app = Yaf_Application::app();
print_r($app);
?>
--was--
Here is an example of how you can get the instance of Yaf_Application from somewhere in your
application.
index.php:
// Set BASE_PATH to one directory up, outside of document root
define('BASE_PATH', realpath(dirname(__FILE__) . '/..'));
// Instantiate new application
$app = new Yaf_Application(BASE_PATH . '/application/config/application.ini');
$app->bootstrap()->run();
Blog.php (controller):
$app = Yaf_Application::app();
print_r($app);
http://php.net/manual/en/yaf-dispatcher.getapplication.php