There are many ways to automate the setting of timestamps in yii ActiveRecord models. Three are presented here:
There are many ways to automate the setting of timestamps in yii ActiveRecord models. Three are presented here:
Validators extending from [CValidator] all have a property named [message|CValidator::message]. You can set this property in the corresponding validation rule to customize the error message. For example, the following validation rule uses an error message that is different from the default one:
Here is a way to dynamically extend tabs based on clips.
Probably even more complex things could be done.
Previously there was described a way to build an application with front-end and back-end. I would like to continue this theme and suggest another way to organize directories using WebApplicationEnd behavior.
This tutorial assumes some basic knowledge of Yii and a functional development environment.
For those who feel, the Controller->accessRules() or RBAC (Role-Based Access Control) is too complicated or doesn't want the username(s) to be hard-coded in accessRules(), here is a very simple, easy-to-implement solution.
pagoda box is very useful tool for a programmer to test their php app online so its very useful one. For deploying code pagodabox use git command
This example uses a MySQL DB with a table named tree
with the fields id
, name
, and parent_id
. The parent_id
will be NULL
for root elements. The SQL is kept simple (no autoinc, no FK, etc).
Logging context information (session, user, ...) to the logfile can be of great help tracking down problems with specific users.
I've found useful to have a step by step reference guide to work with Git with most used commands, feel free to update it with useful information you may find interesting too.
Use SQL SERVER 2000, the date format not like: yyyy/mm/dd hh:mm:ss. So I change to use SQL SERVER 2008 EXPRESS.
For each column of the CGridView, we can specify name
, value
, htmlOptions
, cssClassExpression
etc. In the declarations of the attributes value
and cssClassExpression
we can use the "special" variable $data
, for example like this: 'value'=>'$data->author->username',
.
Now we might want to use $data
in the declaration of the `...
This wiki is a work in progress.
The most difficult thing in a big project, is to manage conflicts with files modified by others users. Git can do this work for us.
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.
I was wondering how to set-up the application parameters in the back-end to use them all around the application without the need of using the database and I came up with this solution, I hope it helps somebody else.
You have a multilingual application, and you want the URL of a page to be different for different languages, to account for SEO. The URL for the contact page for example should look like http://something.com/en/contact in english, and http://something.com/de/contact in german. This tutorial describes how to make it happen.
Note that currently selected language is always a part...
In case of a multilingual application, one might consider it a reasonable approach to store the preferred language of the user in a session variable, and after that, every time a page is requested, to check this session variable and render the page in the indicated language.
This tutorial shows a Yii-way of doing this.
We implement an event handler for the onBeginRequest event; as the nam...
Since Yii 1.0.5 you can use named scopes with ActiveRecords. They are a great help in simplifying your query calls.