Using events with CAction classes
As you know, events are used by:
As you know, events are used by:
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();
Many time for SEO porpouses is important that each page will have a unique address.
A little hint of how to create a progress bar inside the column of the grid, using the 'bootstrap' extension.
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.
Here is overloaded version of CActiveForm.labelEx that adds colon (:) at the end of text of label with respecting CHtml::$afterRequiredLabel and CHtml::$beforeRequiredLabel
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.
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.
Often, when writing widgets or editing Yii code, it is unclear whether or not the code is following the MVC pattern.
What would you do if you want/need to have a different than the main database connection in an module's models?
/*
Get class constants by token.
If you set constants with same prefix, like:
MY_STATUS_1
MY_STATUS_2
MY_STATUS_3
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.
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
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...
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:
Yii::app()->getClientScript()->registerCssFile($filename);
In this tip, I'll help you to change in few second buttons of your CGridView. I hope you like it =).
I've seen a lot of people asking about the logging facilities in Yii and thought I'd share a nice little class I wrote that provides near real-time logging.
Often used scopes to define criteria in our models. This is a very useful feature as it ensures that in any part of application applying the criteria defined by the scope when called it.
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.
You usually take a model instance passed into your view to provide data to a CGridView in this way: