Questions tagged [yii2-advanced-app]

Yii 2 Advanced Application Template is a skeleton Yii 2 application best for developing complex Web applications with multiple tiers. The template includes three tiers: front end, back end, and console, each of which is a separate Yii application. The template is designed to work in a team development environment. It supports deploying the application in different environments.

##Resources

2222 questions
6
votes
3 answers

Yii2 How to call controller action from the view

I have a function in the controller that manipulates data the way I wanted. Now I want to call that function in the index.php file in the view. How do I do that? In my controller function actionTesting($params){ ..... } How can I call it in the…
beginner
  • 2,024
  • 5
  • 43
  • 76
6
votes
1 answer

Yii2 Can we change the assets directory location?

Yii2 automatically generates the assets in web folder. How can we change it to any other folder? For example. If I create a folder named myassets in web folder. It is possible to store all the assets in this folder?
Chinmay Waghmare
  • 5,368
  • 2
  • 43
  • 68
6
votes
1 answer

How to configure global uploadPath and uploadUrl in Yii2?

I want to configure Global Params in Yii2. For example this: This will store the server path for all your file uploads. Yii::$app->params['uploadPath'] = Yii::$app->basePath . '/uploads/'; This will store the Url pointing to server location for…
Mohit Bhansali
  • 1,725
  • 4
  • 20
  • 43
5
votes
2 answers

Pretty URL for one single controller (module) in yii2

Suppose my application path is:- http://www.example.com/index.php?r=dashboard/event/view I make a new controller on which I want to change the URL to pretty URL. Default URL for the new…
pawansgi92
  • 1,065
  • 13
  • 32
5
votes
1 answer

Add letters only validation in a form Yii2

I want to validate my name text box from the special character I try this:- public function rules() { [ 'full_name', 'match', 'pattern' => '/^[a-zA-Z\s]+$/', 'full_name' => 'full_name can only contain word characters' …
Dhaval Soni
  • 85
  • 2
  • 9
5
votes
3 answers

Set values in $_POST in Yii2 on request recieved?

I am writing a interceptor to validate request and decode data received from POST. After decoding data I have to set data to $_POST so that my all previous writer functionality will work as it is. I have set values like below $_POST['amount'] =…
Aabir Hussain
  • 1,161
  • 1
  • 11
  • 29
5
votes
3 answers

Php with Nginx - 403 Forbidden

I want to run project yii2(advanced template) with nginx. I use virtualbox with vagrant(ubuntu 16.04, php 5.6). I have following settings in my Nginx file: vhost1.conf server { listen *:80; server_name frontend.test; …
Stefan Hansch
  • 1,550
  • 4
  • 22
  • 55
5
votes
4 answers

Yii2: How to redirect to with UrlManager?

In my Yii2 config I have: 'components' => [ 'urlManager' => [ 'baseUrl' => '', 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [ 'search' => 'site/index', ... …
sirjay
  • 1,767
  • 3
  • 32
  • 52
5
votes
3 answers

Cannot use yii\base\Object as Object because 'Object' is a special class name yii2 advance

I just bougth a stronger pc, installed composer and wanted to continue my project on it but when I use gii it give me this error. How can I fix it ? Why am I getting it ? Thank you.
user9326044
5
votes
1 answer

how to write if condition inside where condition based on subquery in yii2 query builder

I have a subquery inside main query as below: $subquery = (new Query())->select('COUNT(project_sup_id)') ->from('project_supervisors AS sup') ->where(['AND','sup.project_ref_id = p.project_id']); $uQuery =(new…
rji rji
  • 697
  • 3
  • 17
  • 37
5
votes
1 answer

Yii2 Override find() to add default condition globally

I have to override the method using namespace common\models; use Yii; use yii\db\ActiveQuery; class Addfindcondition extends ActiveQuery { public function init() { $this->andOnCondition([$this->modelClass::tableName() .…
rajwa766
  • 604
  • 13
  • 31
5
votes
0 answers

deleteBlock / replaceBlock not working

I have been facing an issue using PHPWord extension I am trying to generate a cv.docx file out of a template.docx file using Yii2 and PHPWord. Here is my the content to be replaced in my template file: ${EXPERIENCES} ${/EXPERIENCES} Here is the…
ahmednawazbutt
  • 823
  • 12
  • 34
5
votes
5 answers

target _blank in HTML::a not working yii2

I am using below peice of code. [ 'attribute' => 'Application', 'format' => 'html', 'value' => function ($dataProvider) { $student_username = $dataProvider->student_username; return…
Ankur Soni
  • 5,725
  • 5
  • 50
  • 81
5
votes
1 answer

yii2 Updating Tables without primary key

I have a table named SYSTEM_PARAMS like below +------------+------------------+------+-----+---------------------+-----------------------------+ | Field | Type | Null | Key | Default | Extra …
Muhammad Omer Aslam
  • 22,976
  • 9
  • 42
  • 68
5
votes
2 answers

yii2 back to previous page after update

How can i redirect user to previous page after updating a record? this is the typical scenario: Users is in index page and filters results or paginates over the records, then they find the one that they want to edit and click the edit button. They…
farrusete
  • 435
  • 9
  • 24