Questions tagged [yii2-basic-app]

Yii 2 Basic Project Template is a skeleton Yii 2 application best for rapidly creating small projects.

Yii 2 Basic Project Template is a skeleton Yii 2 application best for rapidly creating small projects.

The template contains the basic features including user login/logout and a contact page. It includes all commonly used configurations that would allow you to focus on adding new features to your application.

GitHub

Official Site

800 questions
4
votes
4 answers

setting error action layout in yii2 not working

For setting error action I added this code in my controller public function beforeAction($action) { if ($action->id == 'error') $this->layout = 'iframe-main.php'; $this->enableCsrfValidation = false; return…
Jackhad
  • 411
  • 3
  • 8
  • 19
4
votes
1 answer

Yii2 > How to store html output of a _form view into a string variable

I want to store the rendered html output of a form view which uses ActiveForm and Html Helper into a variable within my Controller. I've tried storing result of a renderPartial directly to a variable, which did not work: $htmlform =…
Trevor
  • 139
  • 1
  • 10
4
votes
2 answers

Invalid Cofiguration - yii\base\InvalidConfigException - Yii2

I've just installed Yii2-User module/Dektrium to my Yii2-app-basic application by this command composer require "dektrium/yii2-user:0.9.*@dev" config/console.php return [ . . 'modules' => [ 'gii' => 'yii\gii\Module', …
Nana Partykar
  • 10,556
  • 10
  • 48
  • 77
4
votes
2 answers

Set href ="#" or unset html::a href from grid-view yii2

I have the following code: [ 'format' => 'raw', 'contentOptions'=>['style'=>'width: 5px;'], 'value' => function($model) { if($model->id == Yii::$app->user->identity->id) { return …
4
votes
3 answers

How to get params in url , and it is array? yii2

I have url like this http://localhost/belajar4/web/index.php?r=data%2Fsingle&id=2&DataSearch[TANGGAL]=2015-08-04&DataSearch[TANGGAL_SELESAI]=2015-08-12 And I want to get DataSearch['Tanggal'] dan DataSearch[TANGGAL_SELESAI] I have tried for id…
4
votes
1 answer

Yii2: Web service Request and Response Logger

I am trying to create a Request and Response Logger for a web service created in Yii 2.0.5 for debugging purpose. Basically my motive is to track all the request, request data, response data and for this purpose I am using Yii Events. So far I have…
Sagar Guhe
  • 1,041
  • 1
  • 11
  • 35
4
votes
3 answers

Yii 2 custom component in application configuration file

I have declared a class class MyClass extends Component { public $prop1; public $prop2; public function __construct($param1, $param2, $config = []) { // ... initialization before configuration is applied …
sudip
  • 2,781
  • 1
  • 29
  • 41
3
votes
2 answers

Yii2 - How to set dynamic authTimeout in User Identity?

Here, I have extended User Identity of Yii2. This is my configuration. 'user' => [ 'identityClass' => app\models\UserMaster::class, 'enableAutoLogin' => false, 'loginUrl' => ['/auth/login'], …
akshaypjoshi
  • 1,245
  • 1
  • 15
  • 24
3
votes
2 answers

Yii2 rules work only use scenario

I write two scenario in Yii2 comment model, when user logged on or is guest. my rules is: public function rules() { return [ [['user_id'], 'required', 'on' => self::SCENARIO_USER], [['name', 'email'], 'required',…
Masoud92m
  • 602
  • 1
  • 8
  • 24
3
votes
3 answers

Yii2, Component, Make a single instance and access it everywhere in the web application

I would like to create a component in yii2 that can be accessed throughout the web application but only create one instance and be able to retrieve that instance wherever needed. namespace app\components; use yii; use yii\base\Object; class…
3
votes
3 answers

how to run custom code after every $model->save() function in yii2

I want to execute my custom code after or before every $model->save() in Yii2. I want to perform this globally like using components, etc. I want to create a user activity log to store how many times a user insert or update any rows in database…
Fahad Ali
  • 114
  • 1
  • 14
3
votes
1 answer

Nginx Yii2 configuration in different folders

I faced with problem in configuring nginx server for yii2 basic app. Here is my service block file : server { listen 80 ; access_log /var/log/nginx/access-server.log; error_log /var/log/nginx/error-server.log; charset…
Farhad
  • 742
  • 6
  • 22
3
votes
1 answer

Yii2. Many inputs for one Model/DB field

How such inputs could be translated into DATE field in DB? Customer insisted on such way to input user birthdate. First my thought was simply to concat in one field in beforeValidate, but after this inputs won't be able to display date, that was…
D.R.
  • 2,540
  • 3
  • 24
  • 49
3
votes
2 answers

Kartik select2 widget not working in Ajax request in Yii2?

I am using kartik select2 widget in my yii2 basic app. now i have to display province names in select2 widget on ajax call. It is working fine if i put it directly in form. however not working with ajax call. Here are my form fields:
Ninja Turtle
  • 1,293
  • 2
  • 24
  • 50
3
votes
1 answer

How can I inject configured Application component into Model instance?

I have a problem described in subject. Let me explain. I use basic application template. I have simple model Search, which uses application component GoogleCustomSearch for search through Google Custom Search API. GoogleCustomSearch has to be…
glagola
  • 2,142
  • 3
  • 17
  • 20
1 2
3
53 54