Wiki

Articles in category "tutorials", sorted by ratingX
Displaying 71-80 of 253 result(s).

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

Created 2 years ago by Kartik VTutorials0 comments – viewed 6,338 times – ( +39 / -4 ) – version 2.0
You may have scenarios, where you want to store a specific array configuration to the database. A classic example could be saving Yii widget configuration to the database and then retrieving it at runtime, with dynamic parameters set. This wiki discusses one of the approaches to do this. Let's consider you have something like the NavBar configuration below to store in the db:

Using your own forked version of extensions with composer

Created 2 years ago by Kartik VTutorials3 comments – viewed 8,748 times – ( +39 / -4 ) – version 2.0
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:

Adding search to Yii blog example (using Zend Lucene)

Created 5 years ago by dckurushinTutorials21 comments – viewed 72,940 times – ( +33 / -3 ) – version 1.1
For this tutorial I will add a search to the blog demo. The search would be based on Zend Lucene.

How to create a breadcrumb widget

Created 7 years ago by knutTutorials4 comments – viewed 69,174 times – ( +13 ) – version 1.1
Here's a simple way to create a breadcrumb widget to be used in your templates. The idea is just to isolate how the breadcrumb is generated based on an array of crumbs.

Simplified meta tags

Created 7 years ago by Y!!Tutorials5 comments – viewed 40,645 times – ( +13 ) – version 1.1
If we want to set meta tags on a per page (controller-action) basis, we may use the clientScript application component.

Handling tabular data loading and validation in Yii 2

Created 2 years ago by Kartik VTutorials6 comments – viewed 33,422 times – ( +44 / -6 ) – version 2.0
How do you read and handle tabular data submission via form in Yii framework 2.0? Sometimes we want to collect user input in a batch mode. That is, the user can enter the information for multiple model instances and submit them all at once. We call this tabular input because the input fields are often presented in an HTML table.

How to create/save more Model inputs and make them repeatable with jQuery

Created 7 years ago by qiangTutorials3 comments – viewed 39,436 times – ( +12 ) – version 1.1
This is the first real problem that I encountered using Yii, trying to make a Model input repeatable in the form, validate and save them.

i18n for your model in just 1 line

Created 6 years ago by mintaoTutorials0 comments – viewed 13,354 times – ( +12 ) – version 1.1
A simple trick to get the localized version of a model field is to add this little method to your models.
tags: i18n

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

Created 2 years ago by Kartik VTutorials0 comments – viewed 16,131 times – ( +38 / -5 ) – version 2.0
Have you faced some of these problems when using composer with your Yii 2 installation?

How to customize the error message of a validation rule

Created 7 years ago by qiangTutorials4 comments – viewed 94,270 times – ( +18 / -1 ) – version 1.1
Validators extending from CValidator all have a property named message. You can set this property in the corresponding validation rule to customize the error message. For example, the following validation rule uses an error message that is different from the default one: