Пример #1
0
 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
0
 /**
  * 
  * @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
0
 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
0
 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
0
 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
0
 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
0
 public function _initView(Yaf_Dispatcher $dispatcher)
 {
     $myView = new View(NULL);
     $dispatcher->setView($myView);
 }
Пример #8
0
 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
0
 public function _initLayout(Yaf_Dispatcher $dispatcher)
 {
     $layout = new View_Layout($this->config->application->layout->directory);
     $dispatcher->setView($layout);
 }
Пример #10
0
 /**
  * [默认视图类(报错已用)]
  * @param  Yaf_Dispatcher $dispatcher [description]
  * @return [type]                     [description]
  */
 public function _initView(Yaf_Dispatcher $dispatcher)
 {
     $dispatcher->setView(new View(null));
 }
Пример #11
0
 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);
 }