Let's say, for example, that you are developing a blog or some kind of CMS and you want to track the number of times each post was viewed (maybe to show a list of the most viewed ones).
Let's say, for example, that you are developing a blog or some kind of CMS and you want to track the number of times each post was viewed (maybe to show a list of the most viewed ones).
A few days ago, i worked for CGridView exporting functional for my client. He asked me to create a simple exporting to a CSV file a CGridView search results.
Note: Please also take a look at the newer EMenu extension. This works even better that the deprecated CDropDownMenu!
Note: Before reading this wiki you should have read the caching part in the Yii guide
He im giving you a very simple example ie how you can store an image to your blob field in a table.Hope you already familiar with the normal image upload.
I installed phpseclib because I needed to do some AES encryption in my project. After all the hassle of installing php lib, I found out that Yii already has a security module (securityManager). I finally decided to keep using phpseclib because it has one big advantage over Yii securityManager module, it does...
It's very common to see new Yii users confusing the relations HAS_ONE
and BELONGS_TO
, and getting it wrong means you won't get proper values back. And though we'll talk about HAS_MANY
as well, we're specifically omitting the MANY_MANY
relation because it's a whole different animal.
Something a good application cant miss is documentation, and what would be better than some nice formatted HTML documentation that can be auto-generated from your code, we know several tools that already do this like phpDocumentor, but today we are introducing Yii Docs Generator...
The sql 'set time_zone' ensures that all dates retrieved are in UTC time. If your MySql server has the time zone names installed then use 'UTC' instead of '+00:00'.
Copy the code at the end of this wiki for LocalTime.php and DefaultDateTimeParser.php int...
In this wiki I will show how to create own custom global function. It may be save the space and reduce the time.
This wiki shall be considered deprecated since the Yii installer for composer has been discontinued.
With Yii you can use one CActiveForm for collecting data for two or more models with ajax validation and client validation.
Yiinitializr\Helpers\Initializer::create('./../', 'frontend', array(
// will override frontend configuration file
__DIR__ .'/../../common/config/main.php', // merged with
__DIR__ .'/../../common/config/env.php', // merged with
__DIR__ .'/../../common/config/local.php' // merged with
))->run();
`
This namespace brings utilities to interact with...
This is what I did. Its the EASIEST solution that I know of. I just reused the advanced search done in CGridView.
First declare an attribute to store the file name in the model class (either a form model or an active record model).
Also declare a file
validation rule for this attribute to ensure a file is uploaded with specific extension name.
Everyone have seen a multilayer menu in several CMS
I assume you are familiar with accessControl standard filter. It allows you to separate privileges to run some action from action code itself. There is however one problem with most common usage - you cannot use bizRules, at least based on some parameters passed to 'checkAccess' just because it is hard to pass them in accessRules() result.
Sometimes the right place to store application data is in a join table. For example, movie viewers either like or don’t like the movies they watched.
Because Yii intends to be integrated nicely with third-party libraries, it does not define any global functions. Everything in Yii needs to be addressed with full class name or object scopes. For example, to access the current user, we need to use Yii::app()->user
; to access application parameters, we need Yii::app()->params['name']
; and so on. While editors like textmate
can help alleviate...
This is a bried guide about displaying of custom sql query results.