本文整理汇总了PHP中Yaf_Dispatcher::setView方法的典型用法代码示例。如果您正苦于以下问题:PHP Yaf_Dispatcher::setView方法的具体用法?PHP Yaf_Dispatcher::setView怎么用?PHP Yaf_Dispatcher::setView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yaf_Dispatcher
的用法示例。
在下文中一共展示了Yaf_Dispatcher::setView方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initView
protected function _initView(Yaf_Dispatcher $dispatcher)
{
$view = new YafView(APPLICATION_VIEW_SCRIPTS_PATH);
$view->enableLayout('layout/normal.phtml');
$dispatcher->setView($view);
// $dispatcher->setView(new YafView(APPLICATION_VIEW_SCRIPTS_PATH));
}
示例2: initYafBySooh
/**
*
* @param \Yaf_Dispatcher $dispatcher
* @param string $jqueryVer 使用的jquery文件,默认值:jquery-1.11.2.min.js
* @return view
*/
public static function initYafBySooh($dispatcher, $jqueryVer = 'jquery-1.11.2.min.js')
{
$router = $dispatcher->getRouter();
$router->addRoute("byVar", new \Yaf_Route_Supervar(SOOH_ROUTE_VAR));
\Yaf_Loader::getInstance()->registerLocalNameSpace($GLOBALS['CONF']['localLibs']);
$req = $dispatcher->getRequest();
$tmp = $req->get('__ONLY__');
if ($tmp == 'body') {
\SoohYaf\Viewext::$bodyonly = true;
}
$tmp = trim($req->get('__VIEW__'));
//html(default),wap, json
define('VIW_INC_PATH', APP_PATH . '/application/views/_inc/');
\SoohYaf\Viewext::$jqueryVer = $jqueryVer;
if (!empty($tmp)) {
$tmp = strtolower($tmp);
\Sooh\Base\Ini::getInstance()->viewRenderType($tmp);
if ($tmp == 'jsonp') {
\Sooh\Base\Ini::getInstance()->initGobal(array('nameJsonP' => $req->get('jsonp', 'jsonp')));
}
}
// $tmp = $dispatcher->getRequest()->get('__GZIP__');
// if(!empty($tmp)){
// $tmp = strtolower ($tmp);
// if($tmp=='gzip')define("ZIP_OUTPUT",$tmp);
// }
$view = new \SoohYaf\Viewext(null);
$dispatcher->setView($view);
$dispatcher->registerPlugin(new SoohPlugin());
return $view;
}
示例3: _initSmarty
public function _initSmarty(Yaf_Dispatcher $dispatcher)
{
/* init smarty view engine */
Yaf_Loader::import("Smarty/Adapter.php");
$smarty = new Smarty_Adapter(null, Yaf_Application::app()->getConfig()->smarty);
$dispatcher->setView($smarty);
}
示例4: _initView
public function _initView(Yaf_Dispatcher $dispatcher)
{
//在这里注册自己的view控制器,例如smarty,firekylin
$smarty = new Smarty_Adapter(null, Yaf_Registry::get("config")->get("smarty"));
Yaf_Registry::set("smarty", $smarty);
$dispatcher->setView($smarty);
//Yaf_Dispatcher::getInstance()->disableView();
//var_dump('sssss');
}
示例5: _initLayout
public function _initLayout(Yaf_Dispatcher $dispatcher)
{
// Enable template layout only on admin
// TODO: make this more accurate
if (strpos($dispatcher->getRequest()->getRequestUri(), "admin") !== FALSE && strpos($dispatcher->getRequest()->getRequestUri(), "edit") === FALSE && strpos($dispatcher->getRequest()->getRequestUri(), "confirm") === FALSE && strpos($dispatcher->getRequest()->getRequestUri(), "logDetails") === FALSE) {
$path = Billrun_Factory::config()->getConfigValue('application.directory');
$view = new Yaf_View_Simple($path . '/views/layout');
$dispatcher->setView($view);
}
}
示例6: _initView
public function _initView(Yaf_Dispatcher $dispatcher)
{
$uri = $dispatcher->getRequest()->getRequestUri();
if ($uri) {
$uriArray = explode('/', $dispatcher->getRequest()->getRequestUri());
switch ($uriArray[1]) {
case 'admin':
$viewPath = APPLICATION_PATH . '/modules/Admin/views';
break;
default:
$viewPath = APPLICATION_PATH . '/views';
}
$view = new TwigAdapter($viewPath, Yaf_Registry::get('config')->get('twig')->toArray());
$dispatcher->setView($view);
}
}
示例7: _initView
public function _initView(Yaf_Dispatcher $dispatcher)
{
$myView = new View(NULL);
$dispatcher->setView($myView);
}
示例8: _initView
public function _initView(Yaf_Dispatcher $dispatcher)
{
//命令行下基本不需要使用smarty
if (REQUEST_METHOD != 'CLI') {
$smarty = new Smarty_Adapter(null, $this->config->smarty);
$smarty->registerFunction('function', 'truncate', array('Tools', 'truncate'));
$dispatcher->setView($smarty);
}
}
示例9: _initLayout
public function _initLayout(Yaf_Dispatcher $dispatcher)
{
$layout = new View_Layout($this->config->application->layout->directory);
$dispatcher->setView($layout);
}
示例10: _initView
/**
* [默认视图类(报错已用)]
* @param Yaf_Dispatcher $dispatcher [description]
* @return [type] [description]
*/
public function _initView(Yaf_Dispatcher $dispatcher)
{
$dispatcher->setView(new View(null));
}
示例11: _initView
public function _initView(Yaf_Dispatcher $dispatcher)
{
//在这里注册自己的view控制器,例如smarty,firekylin
$view = new View_Twig(APPLICATION_PATH . "/application/views/", Yaf_Registry::get("config")->get("twig")->toArray());
$dispatcher->setView($view);
}