本文整理汇总了PHP中Layout::setViewPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Layout::setViewPath方法的具体用法?PHP Layout::setViewPath怎么用?PHP Layout::setViewPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Layout
的用法示例。
在下文中一共展示了Layout::setViewPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new Layout();
$this->object->setViewPath(__DIR__ . '/layouts');
$this->object->setScriptName("layout.phtml");
}
示例2: function
$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
$driverImpl = $config->newDefaultAnnotationDriver(__DIR__);
$config->setMetadataDriverImpl($driverImpl);
$entityManager = \Doctrine\ORM\EntityManager::create($app->getBootstrap()->getResource("config")->database()->toArray(), $config);
return $entityManager;
});
示例3: testLayoutViewHelpersPass
public function testLayoutViewHelpersPass()
{
$this->object->bootstrap('layout', function () {
$l = new Layout();
$l->setScriptName("title-helper.phtml");
$l->setViewPath(__DIR__ . '/layouts');
return $l;
});
$this->object->bootstrap('view', function () {
$v = new View();
$v->setViewPath(__DIR__ . '/views');
$v->addHelper("title", function ($part = false) {
static $parts = array();
static $delimiter = ' :: ';
return $part === false ? implode($delimiter, $parts) : ($parts[] = $part);
});
return $v;
});
ob_start();
$this->object->run(new Request("/general/title-helper"));
$content = ob_get_contents();
ob_end_clean();
$this->assertEquals("<title>the title helper :: second</title>", $content);
}