本文整理汇总了PHP中CController::render方法的典型用法代码示例。如果您正苦于以下问题:PHP CController::render方法的具体用法?PHP CController::render怎么用?PHP CController::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CController
的用法示例。
在下文中一共展示了CController::render方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render($view, $data = null, $return = false, $langSources = array())
{
if (is_null($data)) {
$data = array();
}
Ibos::app()->setting->set("pageTitle", $this->getPageTitle());
Ibos::app()->setting->set("breadCrumbs", $this->getPageState("breadCrumbs", array()));
$this->setPageState("breadCrumbs", null);
!isset($data["assetUrl"]) && ($data["assetUrl"] = $this->getAssetUrl());
$data["lang"] = Ibos::getLangSources($langSources);
return parent::render($view, $data, $return);
}
示例2: render
public function render($view, $data = NULL, $return = false)
{
$controller = $this->getId();
$path = 'application.views.' . $controller . '.' . str_replace('/', '.', $view);
$path = Yii::getPathOfAlias($path);
$style = Settings::model()->getValue('style');
if (file_exists($path . '-' . $style . '.php')) {
$view = $view . '-' . $style;
} elseif (file_exists($path . '-default.php')) {
$view = $view . '-default';
}
parent::render($view, $data, $return);
}
示例3: render
public function render($view, $data = null, $return = false)
{
$this->htmlKeyword = Yii::app()->params['htmlMetadata']['keywords'];
if ($this->htmlTitle) {
$this->htmlTitle .= " | " . Common::strNormal($this->htmlTitle) . " | ";
}
$this->htmlTitle .= Yii::app()->params['htmlMetadata']['title'];
if (!$this->htmlDescription) {
$this->htmlDescription = Yii::app()->params['htmlMetadata']['description'];
}
if ($this->headMeta == '') {
$this->headMeta = '
<meta name="description" content="Amusic - trang nghe nhạc trực tuyến của MobiFone. Nghe nhạc online miễn phí, nghe tải nhạc chất lượng 320kbs về điện thoại nhanh nhất." />
<meta name="keywords" content="nghe nhac truc tuyen, nghe nhac online, trang nghe nhac mobifone, nghe nhac tren dien thoai" />
';
}
parent::render($view, $data, $return);
}
示例4: render
/**
* A simple wrapper around standard Yii {@link \CController::render()}
* method that allows easy data formatting.
*
* @param string $view View name.
* @param array|null $data Data that is used to render a template.
* @param mixed $rawData Raw data that should be formatted using
* {@link \DataFormatter}
* @param bool $return Whether to return data or output it directly.
*
* @throws \EHttpException Thrown if non-html format is used, but no
* `$rawData` is received.
*
* @return string|void Output as string or nothing (depending on `$return`
* argument).
* @since 0.1.0
*/
public function render($view, $data = null, $rawData = null, $return = false)
{
header($this->page->generateFormatHeader());
if ($this->page->format === 'html') {
return parent::render($view, $data, $return);
} else {
if (empty($rawData)) {
throw new \EHttpException(400, 'badRequest.invalidFormat');
}
$formatter = \Yii::app()->formatter;
if (is_array($rawData)) {
$render = $formatter->formatModels($rawData, $this->page->format);
} elseif ($rawData instanceof \CModel) {
$render = $formatter->formatModel($rawData, $this->page->format);
} else {
\Yii::log('Unexpected data type: ' . gettype($rawData), CLogger::LEVEL_ERROR);
throw new \EHttpException(500, 'internalServerError.unexpectedDataType');
}
if (!$return) {
echo $render;
}
return $render;
}
}
示例5: render
public function render($view, $data = null, $return = false)
{
if ($this->beforeRender($view)) {
/**
* Custom condition
**
* guest page
* registers all meta tags
* unset session user_id (after register)
* set theme is active
* Set comment plugin_id
* Set owner and user info
*
*/
// set language sessions
if (isset($_GET['lang']) && $_GET['lang'] != '') {
Yii::app()->session['language'] = $_GET['lang'];
}
// guest page
if ($this->dialogFixed == true) {
$this->pageGuest = true;
}
// registers all meta tags
if (!Yii::app()->request->isAjaxRequest) {
$meta = OmmuMeta::model()->findByPk(1, array('select' => 'office_on, google_on, twitter_on, facebook_on'));
if ($meta->office_on == 1) {
Yii::app()->meta->renderGoogleOwnerMetaTags();
}
if ($meta->google_on == 1) {
Yii::app()->meta->renderGooglePlusMetaTags();
}
if ($meta->facebook_on == 1) {
Yii::app()->meta->renderFacebookMetaTags();
}
if ($meta->twitter_on == 1) {
Yii::app()->meta->renderTwitterMetaTags();
}
}
// unset session user_id (after register)
if (isset(Yii::app()->session['signup_user_id']) && ($currentModule != 'users/signup' || $currentModuleAction == 'users/signup/success')) {
unset(Yii::app()->session['signup_user_id']);
}
// set theme is active
if (!Yii::app()->request->isAjaxRequest) {
Yii::app()->session['theme_active'] = Yii::app()->theme->name;
if ($this->dialogDetail == true) {
Yii::app()->session['current_url'] = $this->dialogGroundUrl;
}
}
// Set owner and user info
if (empty($this->ownerId)) {
$owner = !Yii::app()->user->isGuest ? 'Hi, ' . Yii::app()->user->displayname : 'Hi, Guest';
Yii::app()->params['owner_id'] = '';
} else {
$user = Users::model()->findByPk($this->ownerId, array('select' => 'displayname'));
$owner = $user->displayname;
Yii::app()->params['owner_id'] = $this->ownerId;
}
Yii::app()->params['owner'] = $owner;
parent::render($view, $data, $return);
}
}
示例6: render
function render($layout = "blog", $data = NULL, $return = false)
{
$app = Request::getVar('app', NULL);
$controller = Request::getVar('controller', null);
$view = Request::getVar('view', "category");
$controller = $controller ? $controller : $view;
global $pagetype, $cur_temp, $yiiapp, $cur_temp;
if ($pagetype == 1) {
$found = false;
if (is_dir(ROOT_PATH . "themes/{$cur_temp}")) {
$file_layout = $yiiapp->getViewPath() . "/html/{$app}/{$controller}/{$layout}.php";
if (file_exists($file_layout)) {
$found = true;
$view = "//html/{$app}/{$controller}/{$layout}";
}
}
if ($found == false) {
$file_layout = $yiiapp->getViewPath() . "/{$controller}/{$layout}.php";
if (file_exists($file_layout)) {
$found = true;
$view = "/{$controller}/{$layout}";
}
}
if ($found == false) {
$app_viewpath = PATH_APPS_FRONT . "/{$app}/views";
$file_layout = "{$app_viewpath}/{$controller}/{$layout}.php";
if (file_exists($file_layout)) {
$found = true;
$yiiapp->setViewPath($app_viewpath);
$view = "/{$controller}/{$layout}";
}
}
if ($found == false) {
die("Invalid view");
}
} else {
$view = $layout;
}
parent::render($view, $data, $return);
}
示例7:
function __construct(CController $controller)
{
parent::__construct();
$this->style = $controller->render('/admin/export/quexmlpdf_view', '', true);
}
示例8: render
/**
* Render a view file and return result
*
* If $controller is not set, the (localized) view file is searched in $viewPath
* and the layout in $layoutFile is applied, if set.
*
* @param string $view name of view to render
* @param array $data view data
* @return string rendered content
*/
private function render($view, $data = array())
{
if (($controller = $this->controller) === null) {
static $controller;
if ($controller === null) {
$controller = new CController('pdffile');
}
$controller->layout = $this->layout;
// Required to make console app play nicely during rendering
Yii::app()->attachBehavior('consoleWorkaround', array('class' => 'ConsoleAppWorkaround', '_viewPath' => $this->baseViewPath, '_layoutPath' => $this->layoutPath));
$file = Yii::app()->findLocalizedFile($this->viewPath . '/' . $view . '.php');
if ($file === false) {
throw new CException('Could not find view file ' . $view);
}
ini_set('implicit_flush', false);
$content = $controller->renderInternal($file, $data, true);
if ($controller->layout === null) {
return $content;
}
return $controller->renderInternal($controller->getLayoutFile($controller->layout), array('content' => $content), true);
} else {
return $controller->render($view, $data, true);
}
}
示例9: render
/**
*
* @param string $view
* @param array $data
* @param boolean $return
* @param boolean $processOutput
*/
public function render($view, $data = null, $return = false, $processOutput = true)
{
if (Yii::app()->request->isAjaxRequest === true) {
parent::renderPartial($view, $data, $return, $processOutput);
} else {
parent::render($this->setEmView($view), $data, $return);
}
}
示例10: render
public function render($view, $data = null, $return = false)
{
if (Yii::app()->request->getParam('modal'))
{
$this->layout = false;
}
if (Yii::app()->request->getParam('iframe'))
{
$this->layout = '//layouts/iframe';
}
return parent::render($view, $data, $return);
}
示例11: render
public function render($view, $data = null, $return = false)
{
return parent::render($view, $data, $return);
}
示例12: render
public function render($view, $data = null, $return = false)
{
if (Yii::app()->request->getParam('modal')) {
$this->layout = '//layouts/modal';
Yii::app()->clientScript->scriptMap = ['jquery.js' => false];
} else {
if (Yii::app()->request->getParam('iframe')) {
$this->layout = '//layouts/iframe';
}
}
return parent::render($view, $data, $return);
}