本文整理汇总了PHP中Phalcon\Mvc\View::getRender方法的典型用法代码示例。如果您正苦于以下问题:PHP View::getRender方法的具体用法?PHP View::getRender怎么用?PHP View::getRender使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phalcon\Mvc\View
的用法示例。
在下文中一共展示了View::getRender方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* {@inheritdoc}
*/
public function render($params = array())
{
$currentViewsDir = $this->view->getViewsDir();
$this->view->setViewsDir($this->getServiceViewPath());
$this->view->disableLevel(View::LEVEL_LAYOUT);
$content = $this->view->getRender('services', $this->templateName, $params);
//rollback viewsDir
$this->view->setViewsDir($currentViewsDir);
return $content;
}
示例2: render
/**
* @param string $layout
*
* @return string
*/
public function render($layout = 'edit')
{
$column = $this->_params->getParam('name');
$prefix = $this->_params->getParam('source');
$fieldId = ($prefix ? $prefix . '_' : '') . $column;
$fieldName = $prefix ? $prefix . '[' . $column . ']' : $column;
$defaultParams = $this->_params->getParams();
unset($defaultParams['name']);
$tagParams = array_merge([$fieldName], $this->_params->getParam('tag', []), ['value' => $this->getValue(), 'id' => $fieldId] + $defaultParams);
$this->_params->setParam('id', $fieldId);
// все параметры уже добавлены, в общем списке они не нужны
unset($tagParams['tag']);
$tagParams['class'] = isset($tagParams['class']) ? $tagParams['class'] . ' form-control' : 'form-control';
$layout = $this->_params->getParam('options.layout', $layout);
$this->beforeRender($tagParams);
$this->_view->setLayout($layout);
$this->_view->setVars(['field' => $this, 'model' => $this->_model, 'params' => $this->_params, 'tag' => $tagParams]);
return $this->_view->getRender($this->getLayoutDir($layout), $layout);
}
示例3: renderContent
/**
* render the content of an existing view : $controller/$action and set the response to the modal content
* @param View $view
* @param string $controller a Phalcon controller
* @param string $action a Phalcon action
* @param $params The parameters to pass to the view
*/
public function renderContent($view, $controller, $action, $params = NULL)
{
$template = $view->getRender($controller, $action, $params, function ($view) {
$view->setRenderLevel(View::LEVEL_ACTION_VIEW);
});
$this->content = $template;
}
示例4: renderToolbar
public function renderToolbar()
{
$view = new View();
$viewDir = dirname(__FILE__) . '/views/';
$view->setViewsDir($viewDir);
// set vars
$view->debugWidget = $this;
$content = $view->getRender('toolbar', 'index');
return $content;
}
示例5: testGetRender
public function testGetRender()
{
$view = new Phalcon\Mvc\View();
$view->setViewsDir('unit-tests/views/');
$content = $view->getRender('test5', 'index', array('cool_var' => 'le-this'));
$this->assertEquals($content, '<html>Hey, this is a partial, also le-this</html>' . PHP_EOL);
}
示例6: testViewParamIsset
/**
* @covers \Phalcon\Mvc\View::__isset
*/
public function testViewParamIsset()
{
$view = new View();
$view->setViewsDir('unit-tests/views/');
$view->set_param = 'something';
$content = $view->getRender('test16', 'index');
$this->assertEquals($content, '<html>1</html>' . PHP_EOL);
}
示例7: renderToolbar
/**
* @return string
*/
public function renderToolbar()
{
$view = new View();
$viewDir = __DIR__ . '/views/';
$view->setViewsDir($viewDir);
$view->setVar('debugWidget', $this);
$content = $view->getRender('toolbar', 'index');
return $content;
}
示例8: testViewParamIsset
/**
* @covers \Phalcon\Mvc\View::__isset
*/
public function testViewParamIsset()
{
$this->specify("Setting View parameters doesn't work", function () {
$view = new View();
$view->setViewsDir(PATH_DATA . "views" . DIRECTORY_SEPARATOR);
$view->set_param = "something";
$content = $view->getRender("test16", "index");
expect($content)->equals("<html>1</html>" . PHP_EOL);
});
}