当前位置: 首页>>代码示例>>PHP>>正文


PHP View::setPartialsDir方法代码示例

本文整理汇总了PHP中Phalcon\Mvc\View::setPartialsDir方法的典型用法代码示例。如果您正苦于以下问题:PHP View::setPartialsDir方法的具体用法?PHP View::setPartialsDir怎么用?PHP View::setPartialsDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phalcon\Mvc\View的用法示例。


在下文中一共展示了View::setPartialsDir方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: resourceNotFound

 private function resourceNotFound($resourceKey, View $view)
 {
     $view->setViewsDir(__DIR__ . '/../modules/Index/views/');
     $view->setPartialsDir('');
     $view->message = "Acl resource <b>{$resourceKey}</b> in <b>/app/config/acl.php</b> not exists";
     $view->partial('error/error404');
     $response = new \Phalcon\Http\Response();
     $response->setHeader(404, 'Not Found');
     $response->sendHeaders();
     echo $response->getContent();
     exit;
 }
开发者ID:devsnippet,项目名称:yona-cms,代码行数:12,代码来源:Acl.php

示例2: register

 /**
  * @param string $moduleName
  * @param string $modulePath
  */
 public function register($moduleName, $modulePath)
 {
     $pPath = $this->dependencyInjection->get('config')->projectPath;
     $pDir = substr($pPath, 0, strlen($pPath) - 10);
     $relModulePath = substr($modulePath, strlen($pDir));
     $x = implode('/', array_map(function () {
         return '..';
     }, explode('/', str_replace('//', '/', $relModulePath))));
     $this->view->setMainView('/../' . $x . '/common/views/index');
     $this->view->setPartialsDir('/../' . $x . '/common/views/partial/');
     $this->view->setViewsDir($modulePath . '/views/');
     $this->registerEngine();
     $this->dependencyInjection->set('view', $this->view);
 }
开发者ID:mirobrando,项目名称:ng-phalcon,代码行数:18,代码来源:RegisterView.php

示例3: registerServices

 public function registerServices(DiInterface $di)
 {
     global $config;
     $di->setShared('url', function () use($config) {
         $url = new UrlResolver();
         $url->setBaseUri($config->backend->baseUri);
         return $url;
     });
     $di->setShared('dispatcher', function () {
         $dispatcher = new Dispatcher();
         $dispatcher->setDefaultNamespace("Multiple\\Backend\\Controllers");
         return $dispatcher;
     });
     $di->setShared('view', function () use($config) {
         $view = new View();
         $view->setViewsDir($config->backend->viewsDir);
         $view->setLayoutsDir('layouts/');
         $view->setPartialsDir('partials/');
         $view->registerEngines(array('.phtml' => function ($view, $di) use($config) {
             $volt = new VoltEngine($view, $di);
             $volt->setOptions(array('compiledPath' => $config->backend->cacheDir, 'compiledSeparator' => '_'));
             return $volt;
         }, '.volt' => 'Phalcon\\Mvc\\View\\Engine\\Php'));
         return $view;
     });
 }
开发者ID:lnmtien,项目名称:phalcon-base,代码行数:26,代码来源:Module.php

示例4: setBreadrumbsView

 /**
  * Setup Breadcrumbs views dir
  * @param string $value
  * @access public
  * @return this
  */
 public function setBreadrumbsView(View $view, $value)
 {
     $this->_viewDir = (string) $value;
     $view->setPartialsDir($this->_viewDir);
     $view->partial($this->_partialName, ['elements' => $this->_elements, 'separator' => $this->_separator]);
     return;
 }
开发者ID:stanislav-web,项目名称:phalcon-development,代码行数:13,代码来源:Breadcrumbs.php

示例5: registerServices

 /**
  *
  * @param \Phalcon\DI $di
  */
 public function registerServices($di)
 {
     Admin::instance();
     require __DIR__ . '/../../../../phad/phad.php';
     $di['phadConfig'] = function () {
         $config = (require __DIR__ . '/../../../../phad-config.php');
         return new Config($config);
     };
     $di['view'] = function () {
         $view = new ViewEngine();
         $view->setViewsDir(__DIR__ . '/Views/');
         $view->setLayoutsDir('Layouts/');
         $view->setPartialsDir('Partials/');
         return $view;
     };
     $di['viewSimple'] = function () {
         $view = new Simple();
         $view->setViewsDir(__DIR__ . '/Views/');
         return $view;
     };
     $di['flashSession'] = function () {
         $flashClasses = ['error' => 'alert alert-danger', 'success' => 'alert alert-success', 'notice' => 'alert alert-info', 'warning' => 'alert alert-warning'];
         return new FlashSession($flashClasses);
     };
     $di['session'] = function () {
         $session = new Session();
         $session->start();
         return $session;
     };
     $di['phadAuth'] = function () {
         return new Auth();
     };
     $di['assets'] = function () use($di) {
         $options = ['sourceBasePath' => __DIR__ . '/Assets/', 'targetBasePath' => __DIR__ . '/../../../../public/backend-assets/'];
         $assets = new AssetsManager($options);
         $assets->collection('backend_css')->setTargetPath('final.css')->setTargetUri('backend-assets/final.css')->addCss('bootstrap/css/bootstrap.min.css')->addCss('css/styles.css')->join(true)->addFilter(new AssetsNullFilter());
         $assets->collection('backend_js')->setTargetPath('final.js')->setTargetUri('backend-assets/final.js')->addJs('bootstrap/js/bootstrap.min.js')->addJs('js/custom.js')->join(true)->addFilter(new AssetsNullFilter());
         return $assets;
     };
 }
开发者ID:argentum88,项目名称:phad,代码行数:44,代码来源:Module.php

示例6: initView

 /**
  *
  * @param type $options
  */
 protected function initView($options = [])
 {
     $config = $this->_di->get('config');
     $di = $this->_di;
     if (!file_exists($config->volt->path)) {
         mkdir($config->volt->path, 0777, true);
     }
     $this->_di->setShared('volt', function ($view, $di) use($config) {
         $volt = new Volt($view, $di);
         $volt->setOptions(['compiledPath' => $config->volt->path, 'compiledExtension' => $config->volt->extension, 'compiledSeparator' => $config->volt->separator, 'compileAlways' => (bool) $config->volt->compileAlways, 'stat' => (bool) $config->volt->stat]);
         $compiler = $volt->getCompiler();
         $compiler->addFunction('is_a', 'is_a');
         return $volt;
     });
     $this->_di->setShared('view', function () use($config) {
         $view = new View();
         $view->setViewsDir($config->application->viewsDir);
         $view->setMainView('index');
         $view->setLayoutsDir('layouts/');
         $view->setPartialsDir('partials/');
         $view->registerEngines(['.volt' => 'volt', '.phtml' => 'Phalcon\\Mvc\\View\\Engine\\Php']);
         return $view;
     });
 }
开发者ID:denners777,项目名称:api-phalcon,代码行数:28,代码来源:bootstrap.php

示例7: run

 public static function run()
 {
     if (in_array(APPLICATION_ENV, array('development'))) {
         $debug = new \Phalcon\Debug();
         $debug->listen();
     }
     $di = new \Phalcon\DI\FactoryDefault();
     $config = (include APPLICATION_PATH . '/config/application.php');
     $di->set('config', $config);
     $loader = new \Phalcon\Loader();
     $loader->registerNamespaces($config->loader->namespaces->toArray());
     $loader->register();
     $loader->registerDirs(array(APPLICATION_PATH . "/plugins/"));
     $db = new \Phalcon\Db\Adapter\Pdo\Mysql(array("host" => $config->database->host, "username" => $config->database->username, "password" => $config->database->password, "dbname" => $config->database->dbname, "charset" => $config->database->charset));
     $di->set('db', $db);
     $view = new View();
     /* $view->disableLevel(array(
        View::LEVEL_BEFORE_TEMPLATE => true,
        View::LEVEL_LAYOUT          => true,
        View::LEVEL_AFTER_TEMPLATE  => true
        )); */
     define('MAIN_VIEW_PATH', '../../../views/');
     $view->setMainView(MAIN_VIEW_PATH . 'main');
     $view->setLayoutsDir(MAIN_VIEW_PATH . '/layouts/');
     $view->setPartialsDir(MAIN_VIEW_PATH . '/partials/');
     $volt = new \Application\Mvc\View\Engine\Volt($view, $di);
     $volt->setOptions(array('compiledPath' => APPLICATION_PATH . '/cache/volt/'));
     $volt->initCompiler();
     $viewEngines = array(".volt" => $volt);
     $view->registerEngines($viewEngines);
     $di->set('view', $view);
     $viewSimple = new \Phalcon\Mvc\View\Simple();
     $viewSimple->registerEngines($viewEngines);
     $di->set('viewSimple', $viewSimple);
     $url = new \Phalcon\Mvc\Url();
     $url->setBasePath('/');
     $url->setBaseUri('/');
     $application = new \Phalcon\Mvc\Application();
     $application->registerModules($config->modules->toArray());
     $router = new \Application\Mvc\Router\DefaultRouter();
     foreach ($application->getModules() as $module) {
         $className = str_replace('Module', 'Routes', $module['className']);
         if (class_exists($className)) {
             $class = new $className();
             $router = $class->init($router);
         }
     }
     $di->set('router', $router);
     $eventsManager = new \Phalcon\Events\Manager();
     $dispatcher = new \Phalcon\Mvc\Dispatcher();
     $eventsManager->attach("dispatch:beforeException", function ($event, $dispatcher, $exception) {
         new ExceptionPlugin($dispatcher, $exception);
     });
     $eventsManager->attach("dispatch:beforeDispatchLoop", function ($event, $dispatcher) {
         new LocalizationPlugin($dispatcher);
     });
     $eventsManager->attach("acl", function ($event, $acl) {
         if ($event->getType() == 'beforeCheckAccess') {
             echo $acl->getActiveRole(), $acl->getActiveResource(), $acl->getActiveAccess();
         }
     });
     $dispatcher->setEventsManager($eventsManager);
     $di->set('dispatcher', $dispatcher);
     $session = new \Phalcon\Session\Adapter\Files();
     $session->start();
     $di->set('session', $session);
     $acl = new \Application\Acl\DefaultAcl();
     $acl->setEventsManager($eventsManager);
     $di->set('acl', $acl);
     $assets = new \Phalcon\Assets\Manager();
     $di->set('assets', $assets);
     $flash = new \Phalcon\Flash\Session(array('error' => 'alert alert-danger', 'success' => 'alert alert-success', 'notice' => 'alert alert-info', 'warning' => 'alert alert-warning'));
     $di->set('flash', $flash);
     $di->set('helper', new \Application\Mvc\Helper());
     $application->setDI($di);
     echo $application->handle()->getContent();
 }
开发者ID:bitclaw,项目名称:phalcon-skeleton,代码行数:77,代码来源:Bootstrap.php


注:本文中的Phalcon\Mvc\View::setPartialsDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。