Wiki articles in category Tips

Showing 81-100 of 162 items.

Using events with CAction classes

Created 12 years ago by Antonio Ramirez, updated 12 years ago by 张 迪.

As you know, events are used by:

9 0
9 followers
Viewed: 23 366 times
Version: 1.1
Category: Tips

How to ensure unicity to url

Created 12 years ago by zaccaria, updated 12 years ago by marcovtwout.

Many time for SEO porpouses is important that each page will have a unique address.

13 0
16 followers
Viewed: 23 609 times
Version: 1.1
Category: Tips
Tags: SEO, unique, URL

Extending CActiveForm for some form display fixes and language tweaks

Created 13 years ago by Trejder, updated 13 years ago by Trejder.

In this simple example I'll demonstrate how to extend CActiveForm class to overload some drawing functions to achieve some commonly used fixes in forms.

The colon

Here is overloaded version of CActiveForm.labelEx that adds colon (:) at the end of text of label with respecting CHtml::$afterRequiredLabel and CHtml::$beforeRequiredLabel

5 0
6 followers
Viewed: 23 919 times
Version: 1.1
Category: Tips

BootProgressColumn - Progress Bar Inside GridView Column compatible with 'bootstrap' extension

Created 11 years ago by Luiz, updated 11 years ago by robregonm.

A little hint of how to create a progress bar inside the column of the grid, using the 'bootstrap' extension.

5 0
7 followers
Viewed: 24 383 times
Version: 1.1
Category: Tips

Using sub query for doubletts

Created 11 years ago by mb, updated 10 years ago by mb.

find doubletts by db fields. in this example i will check doublets for 3 tabelfields (col1,col2,col3). so i will get a subquery with the condition, select and grouping of the tablefields. the having with COUNT() > 1 means: find all records more then one result.

$model=new MyModel('search');
$model->unsetAttributes();

3 0
10 followers
Viewed: 24 939 times
Version: 1.1
Category: Tips

Adding a link to a CDataColumn

Created 11 years ago by le_top, updated 11 years ago by le_top.

Backoffice Grid Views often list information like Posts for a blog while showing at the same time linked information like the User who wrote that post. For more efficiency, it is appropriate that the User is displayed as a link to the User detail page.

2 0
8 followers
Viewed: 26 509 times
Version: 1.1
Category: Tips

Model validation for field ranges using yii2-field-range extension

Created 9 years ago by Kartik V, updated 9 years ago by Kartik V.

The yii2-field-range extension enables you to easily setup ActiveField range fields with Bootstrap styling. You basically can setup two attributes joined together like a single field with combined validation error block.

0 0
37 followers
Viewed: 27 588 times
Version: 2.0
Category: Tips

How to organize Design "things" in Yii 2 (themes and layout)

Created 5 years ago by s.oli, updated 5 years ago by samdark.

Sometimes the App needs a nicer look & feel, so its necessary to organize the assets for this and Yii can help a lot to make it easy. In this article I provide tips for handling multiple "Designs". I use these three features:

1 0
2 followers
Viewed: 27 700 times
Version: 2.0
Category: Tips

Code style

Created 13 years ago by zaccaria, updated 13 years ago by g3ck0.

Often, when writing widgets or editing Yii code, it is unclear whether or not the code is following the MVC pattern.

29 0
7 followers
Viewed: 27 703 times
Version: 1.1
Category: Tips
Tags: mvc

Using cache in CActiveDataProvider

Created 12 years ago by Stamm, updated 12 years ago by Stamm.

First param in CActiveDataProvider could be a string with model name or instance of class. So, you may use CActiveRecord::cache() for cache, but you need set third param to 2, because you should cache 2 queries: counting and get data.

17 0
11 followers
Viewed: 27 797 times
Version: 1.1
Category: Tips

Rendering Views and Updating them with Ajax

Created 10 years ago by Manish Gupta, updated 10 years ago by Manish Gupta.

I wanted to implement a widget that could refresh itself through Ajax without refreshing the whole page. CGridView and CListView are excellent examples of such widgets.

1 0
7 followers
Viewed: 27 884 times
Version: Unknown (update)
Category: Tips

Boost composer-asset-plugin update speed

Created 7 years ago by schmunk, updated 7 years ago by samdark.

If you're using a lot of bower and npm assets with Yii 2.0 you might encounter long running composer update tasks.

6 0
6 followers
Viewed: 28 221 times
Version: 2.0
Category: Tips

Key web server settings after installing a fresh Yii 2 basic or advanced app

Created 9 years ago by Kartik V, updated 9 years ago by Kartik V.

So, you have installed a brand new Yii 2 app (basic) or (advanced). Here are a few tips for Apache web server users to get things running more secure and better with your yii2 app.

3 0
46 followers
Viewed: 28 988 times
Version: 2.0
Category: Tips

A simple class to use a different db for a module

Created 12 years ago by tydeas_dr, updated 12 years ago by Maurizio Domba Cerin.

What would you do if you want/need to have a different than the main database connection in an module's models?

8 0
12 followers
Viewed: 29 739 times
Version: 1.1
Category: Tips

Yii Security-extended guide

Created 12 years ago by bingjie2680, updated 12 years ago by bingjie2680.

This article is called extended guide is because there is already a security guide in the Yii tutorial security section. but that guide is not complete in the sense that it does not rise the developers' attention to some other commonly happening attacks: SQL injection and magic URL, which can be major vulnerabilities in you...

6 6
12 followers
Viewed: 30 537 times
Version: 1.1
Category: Tips

Managing constants easily

Created 12 years ago by briiC.lv, updated 12 years ago by briiC.lv.

/*

    Get class constants by token.
    If you set constants with same prefix, like:
	MY_STATUS_1
	MY_STATUS_2
	MY_STATUS_3
4 0
7 followers
Viewed: 30 573 times
Version: 1.1
Category: Tips

Add model validator in Controller

Created 9 years ago by Kostas Apazidis (KonApaz), updated 9 years ago by Kostas Apazidis (KonApaz).

There are cases that model validators should be depended by controller/action and you couldn't manipulate on the model class or using scenarios in easy way

1 1
3 followers
Viewed: 30 790 times
Version: 1.1
Category: Tips

Troubleshooting Rights Extension

Created 12 years ago by junxiong, updated 12 years ago by junxiong.

Rights is one of user interface for Yii's Role Base Access Control extension. It is one of most downloaded extensions in Yii's Web.

5 0
14 followers
Viewed: 30 844 times
Version: 1.1
Category: Tips

Yii2 default values for Index data Provider

Created 9 years ago by CTala, updated 9 years ago by CTala.

Guys,

2 0
5 followers
Viewed: 31 535 times
Version: 2.0
Category: Tips
9 0
15 followers
Viewed: 32 023 times
Version: 1.1
Category: Tips