'submenuTemplate' => '<ul><div class="main_menu">{items}</div></ul>'
linkTemplate
и можно дополнительно настроить в items
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
RewriteEngine On
# End the processing, if a rewrite already occurred
#RewriteRule ^(frontend|backend)/web/ - [L]
# Handle the case of backend, skip ([S=1]) the following rule, if current matched
RewriteCond %{REQUEST_URI} ^/(name_folder/backend)
RewriteRule ^backend(/.*)?$ backend/web/$1 [L]
# handle the case of frontend
RewriteCond %{REQUEST_URI} ^/(name_folder)
RewriteRule ^(.*)$ frontend/web/$1 [L]
name_folder
- имя директории, если проект находится в поддиректории сайта.[
'label' => 'test',
'value' => 'value test'
]
GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'beforeRow' => function($model, $key, $index, $grid){
return '<tr><td colspan="6">' . $model->username . '<td></tr>';
},
'afterRow' => function($model, $key, $index, $grid){
return '<tr><td colspan="6">' . $model->email . '<td></tr>';
},
'columns' => [
// вывод нужных колонок
]
userID
? Ни в одной из предоставленных моделей нет такого атрибута.public function getPersonal()
{
retun $this->hasOne(Personal::className(), ['userID' => 'id']);
}
Yii::$app->user->identity->id
. Вот через этот параметр можно получить данные определённого пользователя из модели Personal.public static function getDataUser($id)
{
$model = Personal::find()->where('id=:id', [':id' => $id])->one();
return $model;
}
$data = Personal::dataUser(Yii::$app->user->identity->id);
echo $data->fio;
и правильно ли задана связь?
$model->getRelation('tovar')
А как посмотреть какие данные возвращает $model
print_r($model)
или print_r($model->attributes)
$form = ActiveForm::begin([
'id' => 'testForm',
'enableAjaxValidation' => true,
//'enableClientValidation' => false,
'validationUrl' => ['dynamic/ajax-validation']
]);
// и действие в контролере
if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
Yii::$app->response->format = Response::FORMAT_JSON;
return ActiveForm::validate($model);
}
<?=$form->errorSummary($model);?>
на <?=$model->getErrors();?>
и выводите в любом месте вёрстки.$query->andFilterWhere(['between', 'price', $this->max, $this->min]);
$renameGroup = new RenameGroup();
if ($renameGroup->load(Yii::$app->request->post()) && $renameGroup->save()) {
if($renameGroup->saveNameGroup($renameGroup->id)){
return $this->refresh();
}
}
$query = Routes::find()
->from(['r' => Routes::tableName()])
->with(['city', 'routesCities', 'price'])
->joinWith([
'city' => function(ActiveQuery $query){
$query->from(['rc1' => Cities::tableName()]);
}
])
->joinWith([
'routesCities' => function(ActiveQuery $query){
$query->from(['rc2' => RoutesCities::tableName()]);
}
])
$query->andFilterWhere([
'r.id' => $this->id,
/*****/
'rc1.id' => $this->city_id, // фильтрую по id города.
]);
[
'attribute' => 'city_id',
'label' => "Города",
'filter' => Cities::find()->select(['title', 'id'])->indexBy('id')->orderBy(['title' => SORT_ASC])->column(),
'value' => function(Routes $routes){
return implode(',', ArrayHelper::map($routes->city, 'id', 'title'));
}
],
if(!Yii::$app->user->isGuest){
echo Nav::widget([
// your code
])
}
echo Nav::widget([
'items' => array_filter([
if(!Yii::$app->user->isGuest) :
[ 'label' => 'выход']
: false,
])
])
'rules' => [
[
'class' => 'yii\web\GroupUrlRule',
'prefix' => 'admin',
'routePrefix' => 'admin',
'rules' => [
'<_a:(login|logout)>' => 'user/users/<_a>',
],
],
// правила не для модуля
]
<?php
namespace app\modules\nameModule;
use yii\base\BootstrapInterface;
class ModuleBootstrap inplements BootstrapInterface{
public function bootstrap($app)
{
$app->getUrlManager()->addRules([
// rule declarations here
], false);
}
}
'bootstrap' => [
'app\modules\nameModule\ModuleBootstrap'
]
'active' => $context->module->id == 'user',