Articles in category "tips", sorted by date (updated)X
Displaying 111-120 of 153 result(s).

how to use github (un)official extension repo in your Yii project

Updated 5 years ago by RusAlexTips4 comments – viewed 8,892 times – ( +4 / -1 ) – version 1.1
Using a git submodule command in your yii project

Send asset folder path to a javascript of a widget

Updated 5 years ago by sensorarioTips4 comments – viewed 23,256 times – ( +4 / -1 ) – version 1.1
When you develop a widget, you could need one image that is in the assets folder, you can use it simply within a css. You can load a css or javascript script doing this:

Shrink Yii, help your IDE and speed up copying

Updated 5 years ago by dckurushinTips4 comments – viewed 10,578 times – ( +10 / -10 ) – version 1.1
In this little tip, I will help you to cut Yii size for about half

Using cache in CActiveDataProvider

Updated 5 years ago by StammTips7 comments – viewed 21,037 times – ( +21 / -1 ) – version 1.1
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.

Customizing Yii's formatting rules (extending CFormatter)

Updated 5 years ago by HaenselTips0 comments – viewed 17,019 times – ( +14 / -1 ) – version 1.1
CFormatter is one of Yii's core components and used to format values displayed in widgets like CGridView or CDetailView. All classic formats like numbers, text, urls or datetime are supported but you may have to use a formatting rule that isn't built in. Let's say we want to display arrays of strings (like tags associated with a product model). When using CDetailView we would usually make use of PHPs implode function to create a simple string value of all values in the $product->tags array.

A simple action for CJuiAutoComplete

Updated 5 years ago by Thiago SouzaTips9 comments – viewed 38,727 times – ( +17 / -2 ) – version 1.1
More or less I use auto-complete field for a form. CJuiAutoComplete is a yii widget for this purposes. The common use case is to make an ajax request and retrieve a list from the database. So in this case you have to write a controller action to return you a json encoded list. What if I had a generic action to do this work for me?

Display a nice exception message on ajax requests

Updated 5 years ago by Maurizio Domba CerinTips3 comments – viewed 38,430 times – ( +13 / -1 ) – version 1.1
When an exception is thrown in our code like
tags: error, exception

an easy way to required multi columns(At least one cannot be blank)

Updated 5 years ago by 1065227709Tips0 comments – viewed 7,103 times – ( +2 / -1 ) – version 1.1
in model add the following code:
tags: rules

Yii CDBHttpSession数据库存储session性能优化实战

Updated 5 years ago by Darwin WenTips0 comments – viewed 9,350 times – ( +1 / -2 ) – version 1.1
上一篇 关于 Yii CHttpSession性能优化篇之源码流程分析 有详细分析CHttpSession执行流程,在了解CHttpSession的详细执行流程之后,我们就可以非常轻松的扩展Yii Session,来优化和符合自己的业务流程。

adding class and links to Ctreeview node

Updated 5 years ago by bingjie2680Tips2 comments – viewed 14,774 times – ( +4 / -1 ) – version 1.1
This article will show you how to add links and class to each node in ctreeview. so you can attach events in js by obtaining handler on anchor or class.
tags: ctreeview, link, class