Пример #1
1
 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;
 }
 /**
  * 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;
 }
Пример #3
0
 /**
  * Render the given view
  *
  * @param string $view
  * @param array $data
  *
  * @return string
  */
 protected function render($view, $data)
 {
     ob_start();
     $this->view->partial($view, $data);
     $content = ob_get_clean();
     return $content;
 }
Пример #4
0
 /**
  * Render template.
  *
  * @param string $template Template name.
  * @param array  $params   Template params.
  *
  * @return string
  */
 private function _viewRender($template, $params)
 {
     ob_start();
     $viewsDir = $this->_view->getViewsDir();
     $this->_view->setViewsDir(ROOT_PATH . '/app/modules/Core/View/');
     $this->_view->partial('partials/profiler/' . $template, $params);
     $this->_view->setViewsDir($viewsDir);
     $html = ob_get_contents();
     ob_end_clean();
     return $html;
 }
Пример #5
0
 public function testIssue2140()
 {
     $view = new View();
     $view->setBasePath(__DIR__ . '/../');
     $view->setViewsDir('unit-tests/views/');
     $html = $view->partial('test2/index', NULL, FALSE);
     $this->assertEquals($html, 'here');
 }