Questions tagged [Yii] (6875)

4
answers

How to optimally implement the front at the Vue back on Yii (preferably without CORS)?

The standard recommendation is to do two subdomain. OK, but then comes the beloved CORS. It can be configured (there is also a lot of joy!), but he will constantly send PREFLIGHT requests to the so-called "complex" requests. Ie, one query will have two. Of course, this does not speed up the site (and annoying!). Such a sp...
kira_Rogahn14 asked April 2nd 20 at 17:41
1
answer

In yii2 how to add to the style ID or class?

In yii2 in the file AppAsset.php to add to the style ID or class in the browser display thus: <link id="theme_css" rel="stylesheet" href="assets/css/light.css"> <link id="skin_css" rel="stylesheet" href="assets/css/skins/default.css"> And not this:<link rel="stylesheet" href="assets/css/light.css"> <l...
german.Schumm asked April 2nd 20 at 17:37
0
answer

In Yii2 how to transfer data when you select select2 dependent select2 via AJAX?

Good afternoon all. Colleagues tell me where in the code am I doing something wrong. There is a form on the form, but Select2 from Kartik. Select points dependent, in the same brands of cars in the other models. By default, dependent select blocked for selection until the selected value of the first. The problem is how to ...
carley72 asked April 2nd 20 at 17:34
2
answers

How to fix error syntax error, unexpected 'if' (T_IF)?

Hello everybody! Please tell me, when using Menu::widget in one of the menu items you want to display the counter on the condition, I wrote the following:[ 'label' => 'the Internet', 'icon' => 'envelope-o', 'url' => ['/mailbox'], 'template'=>'<a href="{url}">{icon} {label}<span class="pull-right-con...
raymond_Schu asked April 2nd 20 at 17:30
1
answer

Why doesn't a custom rule activeForm?

There is a form with a field (there are other fields, but the theme does not apply):<?=$form->field($model,'date', ['enableAjaxValidation' => true, 'enableClientValidation' => false])->input('date');?> and there is a test custom rule that, in theory, should always give an error.public function rules() { r...
Raymundo.Schmeler asked April 2nd 20 at 17:23
2
answers

Yii2 — How to bring the module in View of the main page?

Read the official Doc for Yii2 as for the Modules: https://www.yiiframework.com/doc/guide/2.0/ru/stru... In principle, everything is clear and logical, but given previous experience with CMS-kami immediately there was a burning desire to sculpt the test module and display it for example in seitbai the main page: And here ca...
trace_Kuh asked April 2nd 20 at 17:11
0
answer

How to load data into a related model in yii?

Hi. Is the model with the relationship:/** * This is the model class for table "{{%setting}}". * * @property int $id * @property string $name * @property int $status */ class Setting extends \yii\db\ActiveRecord { ... public function getAssign() { return $this->hasOne(SettingAssign::className(), ['setting_id' =>...
pascale_Grady asked April 2nd 20 at 17:07
2
answers

How to make a query filter from unwanted domains, with the exception of a request for a certain path?

Situation: there are many domains that are directed to one server IP using an a record. I.e. showing the same content.Objective: to give the domain access to only a specific path, requests for other ways to redirect/error page. With the exception of the primary domain, it is possible any way.Example:Example(text) our-domai...
jamar7 asked April 2nd 20 at 16:52
2
answers

How to beat nasty CORS in Yii?

Writing a REST application. There is a controller test. The treatment of AJAX by default the url of type 127.0.0.1:8000/tests work fine. Trying to add a custom URL. In the controller, create the corresponding action :public function actionYo() { return ['result' => 'YO! Often quite counter intuitive!!!! ']; } the ranti...
Abagail_Bergstrom asked April 2nd 20 at 16:51
1
answer

Yii access — do I have to specify the list of action games in 'Only'?

Try the access control (filter). There is a Blog Controller and his action: index add. When that's code for some reason in any case (and blog/index and blog/add) throws login although the list is only action add:public function behaviors() { return [ 'access' => [ 'class' => AccessControl::className(), 'rules' =&g...
Virgil7 asked April 2nd 20 at 16:46