public function indexAction() { $view = new View("DJView"); $view->setViewPath(APPLICATION_PATH . DIRECTORY_SEPARATOR . "views"); $view->setAttribute("beatModel", $this->beatModel); return $view; }
public function setViewPath($pa_view_paths) { $this->opa_view_paths = $pa_view_paths; if ($this->opo_view) { $this->opo_view->setViewPath($pa_view_paths); } }
public function testSetNoRender() { $v = new View(); $v->setViewPath(__DIR__ . '/views'); $this->object->setView($v); $this->object->value = "hello"; $this->assertSame($v, $this->object->getView()); $this->object->setNoRender(); $this->assertNotSame($v, $this->object->getView()); }
<?php require_once __DIR__ . '/../../vendor/autoload.php'; define("APPLICATION_ENV", 'development'); $app = new Application(); $app->setControllerPath(__DIR__ . '/../app/controllers'); $classLoader = new \Doctrine\Common\ClassLoader('Wdm', __DIR__ . '/../app/models'); $classLoader->register(); $app->bootstrap("config", function () { $config = new Config(); $config->load(__DIR__ . '/../app/configs/application.ini'); return $config; }); $app->bootstrap("view", function () { $view = new View(); $view->setViewPath(__DIR__ . '/../app/views'); return $view; }); $app->bootstrap("layout", function () { $layout = new Layout(); $layout->setViewPath(__DIR__ . '/../app/layouts'); return $layout; }); $app->bootstrap("entityManager", function () use($app) { $config = new \Doctrine\ORM\Configuration(); // (2) // Proxy Configuration $config->setProxyDir(__DIR__ . '/../app/models/Wdm/Proxies'); $config->setProxyNamespace('Wdm\\Proxies'); $config->setAutoGenerateProxyClasses(APPLICATION_ENV == "development"); // Mapping Configuration
public function testViewSwitch() { $this->object->bootstrap("view", function () { $v = new View(); $v->setViewPath(__DIR__ . '/views'); return $v; }); ob_start(); $this->object->run(new Request("/general/a")); $content = ob_get_contents(); ob_end_clean(); $this->assertEquals("This is B", $content); }
<?php set_include_path(get_include_path() . ';' . realpath(__DIR__)); function _autoloader($className) { $filePath = str_replace('_', '/', $className) . ".php"; require_once $filePath; } spl_autoload_register("_autoloader"); $config = (include __DIR__ . '/../config/config.php'); Connection::setConnection(Connection::createConnection($config['db']['host'], $config['db']['user'], $config['db']['password'], $config['db']['dbname'])); View::setViewPath($config['viewPath']);