Wiki articles

Showing 101-120 of 143 items.
Created 4 years ago by Kartik V, updated 4 years ago by Kartik V.

Displaying uploaded file from DB for update with FileInput widget

This is for folks who are using \kartik\widgets\FileInput to upload files from your client. How do you display an image for update after you have uploaded it to the server using the widget?

1 3
42 followers
Viewed: 41 569 times
Version: 2.0
Category: How-tos
Created 4 years ago by Kartik V, updated 4 years ago by Kartik V.

Managing a star rating with the StarRating widget in Yii 2

In Yii 1.x, there was a built in widget CStarRating based on the jquery star rating plugin. There exists no prebuilt solution in Yii2, however the same concepts can be extended using any jquery plugin.

1 3
41 followers
Viewed: 14 259 times
Version: 2.0
Category: How-tos
Created 4 years ago by Kartik V, updated 4 years ago by Kartik V.

Managing your nested dropdown dependency with DepDrop widget

If you are coming over to Yii 2 from Yii 1.x, you may have already read this useful wiki for creating dependent dropdowns. You can use a similar approach in Yii 2 to do the same. But if you are looking at a prebuilt solution that helps you manage it easier, read along.

1 3
42 followers
Viewed: 30 289 times
Version: 2.0
Category: Tutorials
Created 4 years ago by Kartik V, updated 2 years ago by Kartik V.

Using your own forked version of extensions with composer

So you want to use a fork of any existing vendor extension with your Yii 2 install and use the fork, instead of original source. This does not need you to push any update or register your package on packagist.org. You are recommended to follow the approach below:

3 2
40 followers
Viewed: 13 567 times
Version: 2.0
Category: Tutorials
Created 4 years ago by Kartik V, updated 4 years ago by Kartik V.

Install specific Yii2 vendor extension & dependency without updating other packages.

The tips here are for advanced usages of composer and its assumed you have read about using composer and have a knowledge of your vendor packages to be updated. Let's consider, you want to update only one specific yii2 vendor library, without updating all the other extension packages?

2 3
39 followers
Viewed: 22 288 times
Version: 2.0
Category: Tips
Created 4 years ago by Kartik V, updated 4 years ago by Kartik V.

Locking your Yii 2 project package versions with composer.lock

Ok, you have installed a Yii 2 basic or advanced app for the first time and completed the post install steps. You have picked up a few extensions to install for the first time as well. You would already see a composer.lock file in your application root folder.

0 2
37 followers
Viewed: 7 774 times
Version: 2.0
Category: Tips
Created 4 years ago by Kartik V, updated 4 years ago by Kartik V.

How to store array/widget configuration to the database with config validation rules

Note the tag {{homeUrl}} will be dynamically replaced at runtime.

0 2
40 followers
Viewed: 9 781 times
Version: 2.0
Category: Tutorials
Created 4 years ago by CTala, updated 4 years ago by CTala.

My Own Components Folder in Yii2

In Yii1 I used to have my own components under the components folder of the structure, now with namespacing this is a little bit different.

2 1
2 followers
Viewed: 12 260 times
Version: 2.0
Category: Tips
Created 4 years ago by Kartik V, updated 4 years ago by toph.

FORM with GET method causes repeated stacking of URL Parameters

// In Yii 1.x $form = $this->beginWidget('CActiveForm', [

'id' => 'order-search-form',
'method' => 'get',

]); echo $form->textInput($searchModel, 'id'); echo CHtml::submitButton('Find', ['class' => 'btn btn-primary']); $this->endWidget(); `

2 2
40 followers
Viewed: 35 637 times
Version: all
Category: Tips
Created 4 years ago by Kartik V, updated 3 years ago by Kartik V.

Yii 2 list of path aliases available with default basic and advanced app.

If you are coming over from Yii 1.x to Yii 2, and already read this guide, you may note that namespaces are very important in Yii 2 to identify classes. But do you know the list of seeded path aliases that come shipped with a basic or advanced app? Here is my attempt to list them.

10 3
47 followers
Viewed: 115 674 times
Version: 2.0
Category: Tips
Created 4 years ago by Kartik V, updated 2 years ago by Said Bakr.

Handling tabular data loading and validation in Yii 2

The only differences in Yii 2 is that its much simpler due to available functions in the Model class for loading and validating models.

2 2
51 followers
Viewed: 43 637 times
Version: 2.0
Category: Tutorials
Created 4 years ago by Kartik V, updated 4 years ago by Kartik V.

Overcoming removal of client helpers (e.g. ajaxLink) and ClientScript in Yii 2.0

Alternatively, inline assets (JS/CSS) can be registered at runtime from within the View. For example you can clearly simulate the ajaxLink feature using a inline javascript. Its however recommended if you can merge where possible, client code (JS/CSS) into separate JS/CSS files and loaded through the AssetBundle. Note there is no more need of a CClientScript anymore:

0 2
40 followers
Viewed: 28 112 times
Version: 2.0
Category: FAQs
Created 4 years ago by Kartik V, updated 5 months ago by alrazi.

Activating Bootstrap 3 Tooltips & Popover for your Yii Site.

Step 1: Initialize the Bootstrap Tooltip & Popover plugins in your view layout file @web\views\layouts\main.php. Add this to somewhere in the beginning head section (after you have loaded the Jquery using your AppAsset or something similar).

1 2
47 followers
Viewed: 45 040 times
Version: 2.0
Category: Tips
Created 4 years ago by CTala, updated 4 years ago by CTala.

Yii2 default values for Index data Provider

Guys,

1 0
5 followers
Viewed: 21 648 times
Version: 2.0
Category: Tips
Created 4 years ago by Kartik V, updated 4 years ago by Kartik V.

How to read HTML5 Multiple File Input from controller?

0 2
39 followers
Viewed: 11 273 times
Version: all
Category: How-tos
Created 4 years ago by Kartik V, updated 4 years ago by Kartik V.

What to do when composer fails to update your vendor packages?

  • Running a composer update does not fetch any new packages (even though the source is updated)
  • A specific vendor package never gets updated
  • Facing on and off problems when fetching packages while performing composer update.
  • You ran a composer update earlier, but it was partially done, before you lost network connectivity, and you cannot refresh packages anymore.
0 3
36 followers
Viewed: 23 442 times
Version: 2.0
Category: Tutorials
Created 4 years ago by robregonm, updated 4 years ago by robregonm.

Cómo enviar emails usando SMTP

2 0
2 followers
Viewed: 12 390 times
Version: 2.0
Category: How-tos
Created 4 years ago by robregonm, updated 4 years ago by robregonm.

How to send emails using SMTP

5 0
8 followers
Viewed: 74 432 times
Version: 2.0
Category: How-tos
Created 4 years ago by Antonio Ramirez, updated 2 months ago by CeBe.

How to use GridView with AJAX

With the adoption of PJax on Yii2 things  have change quite a bit with GridView when it comes to work with them in AJAX mode. It will probably be confusing at the beginning, but then you will soon realize how powerful the new approach is.

8 0
15 followers
Viewed: 63 941 times
Version: 2.0
Category: How-tos
Tags: pjax, widget, yii2
Created 4 years ago by Antonio Ramirez, updated 2 years ago by Cozumel.

Escape from Default's Yii2 Delete Confirm Box

If you started playing with Yii2's new GridView, you will soon realize that some things have improved quite a lot, but I am sure its going to be a bit confusing at first glance when you try to modify certain javascript behaviors like for example, its delete confirmation dialog box.

4 1
16 followers
Viewed: 29 611 times
Version: 2.0
Category: How-tos