本文整理汇总了PHP中yii\base\Controller::renderPartial方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::renderPartial方法的具体用法?PHP Controller::renderPartial怎么用?PHP Controller::renderPartial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\base\Controller
的用法示例。
在下文中一共展示了Controller::renderPartial方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionGet_product_view
public function actionGet_product_view()
{
if (Yii::$app->request->isAjax) {
$id = $_POST['id'];
$response['update_view'] = \yii\base\Controller::renderPartial('view', ['model' => $this->findModel($id)]);
return json_encode($response);
}
}
示例2: show
public function show($type = 'T')
{
$model = new Controller();
$userMenu = ArrayHelper::map(self::find()->where(['type' => $type])->all(), 'title', 'url');
$pageMenu = ArrayHelper::map(Pages::find()->where(['menu' => $type])->all(), 'title', 'url');
foreach ($pageMenu as $title => $url) {
$pageMenu[$title] = Url::toRoute(['/page/view', 'url' => $url]);
}
$items = array_merge($userMenu, $pageMenu);
return $model->renderPartial('/report/menu', ['items' => $items]);
}
示例3: setView
/**
* Displays an e-mail in preview mode.
* @param string $view the view name. Please refer to [[render()]] on how to specify a view name. example: '//mail/register', the view file in backend backend/views folder.
* @param array $vars the parameters (name-value pairs) that should be made available in the view. example: ['name' => 'harry', 'link' => 'http://wm.com/XXXX'].
* @param string $layout example: '//layouts/email', the view file in backend backend/layouts folder.
*/
public function setView($view, $vars = array(), $layout = null)
{
// Get default controller
$controller = Yii::$app->controller;
if (empty($controller)) {
$controller = new Controller('site', Yii::$app->module);
}
$body = $controller->renderPartial($view, $vars);
if ($layout === null) {
$this->_view = $body;
} else {
// Render the layout file with content
$this->_view = $controller->renderPartial($layout, array('content' => $body));
}
}
示例4: actionProduct_view
public function actionProduct_view()
{
if (Yii::$app->request->isAjax) {
$this->layout = 'blank';
$id = $_POST['id'];
$model = ProductCategory::find()->where(['id' => $id])->one();
$data = ProductCategoryRel::find()->where(['category_id' => $id])->orderBy('sort_order', 'DESC')->all();
$response['upload_view'] = \yii\base\Controller::renderPartial('product_list_product_view', ['model' => $model, 'data' => $data]);
$response['Category_name'] = $model->cat_title;
return json_encode($response);
}
}