Wiki

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

Customizing Yii's formatting rules (extending CFormatter)

Updated 3 years ago by HaenselTips0 comments – viewed 14,538 times – ( +14 ) – 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 3 years ago by Thiago SouzaTips9 comments – viewed 32,614 times – ( +17 / -1 ) – 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 3 years ago by Maurizio Domba CerinTips3 comments – viewed 31,161 times – ( +13 ) – 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 3 years ago by 1065227709Tips0 comments – viewed 5,541 times – ( +2 ) – version 1.1
in model add the following code:
tags: rules

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

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

adding class and links to Ctreeview node

Updated 3 years ago by bingjie2680Tips2 comments – viewed 13,027 times – ( +4 ) – 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

BaseModuleAR class with MultiActiveRecord

Updated 4 years ago by GustavoTips0 comments – viewed 7,260 times – ( +2 ) – version 1.1
MultiActiveRecord is an extension that add support for multiple database connection for your application.

Search method of a model for filters when using dates - unixtimestamp in database

Updated 4 years ago by jwernerTips1 comment – viewed 25,028 times – ( +10 ) – version 1.1
I ran into a problem and on irc we worked it out. Since there is a lack on information on filters in genral i thought i'd start sharing all my findings, might be usefull for other people.

Using MBMenu and Rights to automatically create menu item for your modules

Updated 4 years ago by dinhtrungTips2 comments – viewed 12,640 times – ( +1 / -1 ) – version 1.1
Using Rights generator component, we can easily create a dynamic menu, in which we scan every modules' controllers, to access the index page of them.

Using CJuiDialog to edit rows in a CGridView

Updated 4 years ago by Russell EnglandTips8 comments – viewed 29,804 times – ( +4 / -1 ) – version 1.1
I have a CGridView with a list of clients/events. For each row (EventClient) I wanted a quick edit dialog.