Wiki

Sorted by commentsX
Displaying 111-120 of 747 result(s).

How to automate timestamps in ActiveRecord models

Created 6 years ago by dalipTutorials8 comments – viewed 117,968 times – ( +30 ) – version 1.1
There are many ways to automate the setting of timestamps in yii ActiveRecord models. Three are presented here:

Generate a multi-lever array sub-category for a menu

Created about a year ago by Kostas Apazidis (KonApaz)How-tos8 comments – viewed 12,913 times – ( +10 ) – version 1.1
Everyone have seen a multilayer menu in several CMS

How to use bizRules in standard accessControl filter

Created about a year ago by Maciej LiżewskiHow-tos8 comments – viewed 10,826 times – ( +3 ) – version 1.1
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.

Accessing data in a join table with the related models

Created 3 years ago by fsbHow-tos8 comments – viewed 80,025 times – ( +26 / -1 ) – version 1.1
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.

Use shortcut functions to reduce typing

Created 5 years ago by qiangTutorials8 comments – viewed 43,425 times – ( +56 ) – version 1.1
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 the problem of these lengthy typings, it is worthwhile to define global shortcut functions to some commonly used method calls. They will make the application code look cleaner.

A Multi-Tenant Strategy using Yii and MySQL

Created about a year ago by JFReyesHow-tos8 comments – viewed 13,541 times – ( +9 ) – version 1.1
This article describes an implementation of multi-tenancy using Yii and MySQL.

Saving files to a blob field in the database

Created 4 years ago by zaccariaTips8 comments – viewed 45,645 times – ( +9 / -2 ) – version 1.1
As a follow-up from the How to upload a file using a model wiki entry that explains how to save a file to the filesystem, this article will do the same using a blob field in the database.
tags: File upload

Custom Number Formatting or Decimal Separators and i18n

Created 2 years ago by c@cbaTutorials8 comments – viewed 38,547 times – ( +7 ) – version 1.1
By default, the decimal separator in php (also in mysql) is a dot (.). So when we work with floats in Yii (in calculations, validation, sql statements etc.), the decimal separator has to be a dot. If we want to use for example a comma (,) as the decimal separator, that is if we want to display numbers and enable users to enter numbers with a comma before the decimals, we have to...

How to log and debug variables using CWebLogRoute

Created 4 years ago by Antonio RamirezHow-tos8 comments – viewed 53,266 times – ( +18 ) – version 1.1
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

Moving project code outside of webroot (plus multiple project support)

Created 4 years ago by Steve FriedlHow-tos8 comments – viewed 42,459 times – ( +22 / -1 ) – version 1.1
Yii's by-default directory organization works well enough, but there are several steps one can take that improve the security and serviceability of the system, especially in the context of multiple Yii projects on the same machine (including multiple versions of the same project).
tags: config, security