Wiki

Sorted by date (updated)X
Displaying 351-360 of 483 result(s).

Avoiding duplicate script download when using CActiveForm on Ajax calls

Updated about a year ago by Maurizio DombaTutorials2 comments – viewed 10,448 times – ( +11 / -1 )
Sometimes the active form we wish to use to edit/add a new element on our database is too small and we believe that is much better to use an AJAX'ed dialog/slide form rather than reloading the page to just display one or two fields.

Customizing Yii's formatting rules (extending CFormatter)

Updated about a year ago by HaenselTips0 comments – viewed 8,705 times – ( +14 )
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 about a year ago by Thiago SouzaTips7 comments – viewed 18,482 times – ( +14 / -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 about a year ago by Maurizio DombaTips1 comment – viewed 15,785 times – ( +11 )
When an exception is thrown in our code like
tags: error, exception

How to use EzComponents in Yii

Updated about a year ago by samdarkHow-tos0 comments – viewed 5,842 times – ( +5 )
change your index.php

Configuring controller access rules to default-deny

Updated about a year ago by samdarkHow-tos1 comment – viewed 31,326 times – ( +10 )
Starting with the blog tutorial, Yii developers are familiar with the notion of access rules defined in the controller, where the actions are allowed or denied depending on the user's name or role.

Run Yiic directly from your app without a shell

Updated about a year ago by jacmoeHow-tos5 comments – viewed 11,723 times – ( +16 )
Sometimes it would be nice if we could run yiic from an action, for example a migrate database button in our admin panel. Or because you are on a host which doesn't have shell access. Or maybe you are not allowed run popen or exec.

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

Updated about a year ago by 1065227709Tips0 comments – viewed 3,581 times – ( +1 )
in model add the following code:
tags: rules

Using a CDbDataReader (sql query result) in a zii widget (such as CGridView or CListView)

Updated about a year ago by Revelis Luc BonninHow-tos1 comment – viewed 13,439 times – ( +9 / -1 )
If in your application you have to proceed to a complex SQL query that is not associated to a model, you will use CDbDataReader like it is described in the Yii documentation. An example could be

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

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