Wiki

Articles in category "how-tos", sorted by commentsX
Displaying 61-70 of 189 result(s).

Run Yiic directly from your app without a shell

Created about a year ago by jacmoeHow-tos5 comments – viewed 11,727 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.

CPhpAuthManager - how it works, and when to use it

Created about a year ago by dckurushinHow-tos5 comments – viewed 12,755 times – ( +1 / -3 )
Before reading this article, you should first learn this How to setup RBAC with a php file

How to use nested DB transactions (MySQL 5+, PostgreSQL)

Created 3 years ago by mindehHow-tos4 comments – viewed 13,528 times – ( +34 )
Original source code and idea are from: PHP, PDO & Nested Transactions.

Tarpit for bad bots

Created about a year ago by mitherealHow-tos4 comments – viewed 3,914 times – ( +1 )
I recently built a tarpit for bad bots.
tags: tarpit, bots

Reference: Model rules validation

Created 3 years ago by krillzipHow-tos4 comments – viewed 267,243 times – ( +88 )
This is a reference to be used for Model rule validation and is compiled from the Yii documentation and code. The purpose is to have all the information gathered in one place instead of scattered. This reference is not an intro. See The Definitive Guide to Yii, Declaring Validation Rules for a tutorial.

Using SQLite and CDbMessageSource as a module

Created 11 months ago by pheadeauxHow-tos4 comments – viewed 4,694 times – ( +4 )
There are scenarios when you work with DVCS (like Mercurial or Git) and CDbMessageSource. To my experience keeping the development database and production database in sync can be very time consuming. Plus, when working in a team, you never know when the database was updated.

Implementing cron jobs with Yii

Created 2 years ago by samdarkHow-tos4 comments – viewed 30,482 times – ( +26 / -1 )
There are two ways to run a cron job:
tags: cron, cli

How to log and debug variables using CWebLogRoute

Created 2 years ago by Antonio RamirezHow-tos4 comments – viewed 30,146 times – ( +13 )
I have seen a couple of articles about how to integrate external libraries to debug our PHP code (i.e. firePHP) but after you read this article you will realize that there is no need for such libraries when using Yii.
tags: Logging

Using standard filters in CGridView custom fields

Created 2 years ago by GOshaHow-tos4 comments – viewed 35,412 times – ( +15 )
In this article I'll try to explain how to use standard quick search fields in CGridView with customized columns.For example: We have a record in a database with field switch having 0 or 1 values. After that we want a user to see on or off instead 1 or 0. So we do the usual thing:

Dynamic Sidebar using CClipWidget

Created 2 years ago by SheldmanduHow-tos4 comments – viewed 15,582 times – ( +19 )
Most applications will have one or two sidebars and often you want to control the content that should appear in the sidebar based on the action. For example you will want to show something different on the homepage as opposed to some view page. While achieving this you generally also want to avoid putting the layout into each view, as that would mean if you wanted to change the layout (e.g. put the sidebar on the left instead of the right or do some funky layout which requires an additional div tag to be added) you'd have to go through every view, which does not achieve good code re-use. It is also bad practice to have lots of if statements in column2 layout just so that you can generate the sidebar correctly.