Wiki articles in category Tips

Showing 101-119 of 119 items.

Real Time Logging

Created 13 years ago by lucifurious, updated 13 years ago by lucifurious.

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.

13 0
17 followers
Viewed: 35 372 times
Version: 1.1
Category: Tips

Getting nulls from database instead of empty strings

Created 12 years ago by samdark, updated 12 years ago by samdark.

To get null from database instead of empty strings you need to set up your DB connection as follows:

13 0
11 followers
Viewed: 20 034 times
Version: 1.1
Category: Tips
Tags: database, null

How to ensure unicity to url

Created 12 years ago by zaccaria, updated 12 years ago by marcovtwout.

Many time for SEO porpouses is important that each page will have a unique address.

13 0
16 followers
Viewed: 23 664 times
Version: 1.1
Category: Tips
Tags: SEO, unique, URL
14 0
20 followers
Viewed: 77 218 times
Version: 1.1
Category: Tips

1:n relations sometimes require CDbCriteria.together

Created 12 years ago by fsb, updated 10 years ago by fsb.

There are situations in which Active Record will generate nonsense queries from what a nieve Yii user might think is reasonable code. One such situation is a CActiveDataProvider using CDbCriteria to get data from parent and 1:n child table with a condition on the child table.

15 0
12 followers
Viewed: 51 316 times
Version: 1.1
Category: Tips

How to upload image(photo), and path entry in database with update functionality

Created 11 years ago by kiran sharma, updated 10 years ago by Shahcheraghean.

I saw many posts that community newbie is confuse in image/photo upload with random name. so I post this topic covering all useful things regarding to image/photo upload(not covering image attribute related functionality)

15 0
39 followers
Viewed: 210 000 times
Version: 1.1
Category: Tips

htmlOptions explained for various controls.

Created 13 years ago by Woil, updated 13 years ago by Woil.

Most controls that are rendered by CHtml have an argument called $htmlOptions. This argument is an array that holds the attributes of the HTML element. For example the following code:

15 0
14 followers
Viewed: 65 838 times
Version: 1.1
Category: Tips

Special $variables in CGridView and CListView

Created 12 years ago by Steve Friedl, updated 12 years ago by Steve Friedl.

The popular [CListView] and [CGridView] widgets each take a data provider and iterate over each data object produced, calling the user's code to render each row one at a time, and most are familiar with the use of the $data variable to represent the current model object or array.

23 1
33 followers
Viewed: 77 249 times
Version: 1.1
Category: Tips

Understanding series articles

Created 12 years ago by GOsha, updated 12 years ago by GOsha.

Here are all wiki articles from "Understanding" series by Yii wiki contributors:

16 0
12 followers
Viewed: 14 106 times
Version: 1.1
Category: Tips

Using cache in CActiveDataProvider

Created 12 years ago by Stamm, updated 12 years ago by Stamm.

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.

17 0
11 followers
Viewed: 27 831 times
Version: 1.1
Category: Tips

Reading the doc

Created 13 years ago by zaccaria, updated 13 years ago by Orteko.

Almost all the information you need whilst working with yii is written in the Class Reference.

21 0
3 followers
Viewed: 12 421 times
Version: 1.1
Category: Tips
Tags: doc

An easy way to display a success page using flash messages

Created 13 years ago by qiang, updated 13 years ago by qiang.

We often need to display a success page after the user has submitted a form without problem. We may show some welcome message after a user registers a new account. There are many ways to implement this workflow. In this article, I will explain a method that exploits flash messages.

21 0
29 followers
Viewed: 56 583 times
Version: 1.1
Category: Tips

Adding Yii Search to Your Browser Search Box

Created 13 years ago by qiang, updated 6 years ago by CeBe.

The official Yii project site now supports OpenSearch. This means you can customize your browser's search box to enable direct search of the content in yiiframework.com. For example, by entering a Yii class name in the browser's search box, the corresponding class API page will be shown in the browser.

25 0
6 followers
Viewed: 63 448 times
Version: all
Category: Tips

URL component access functions

Created 13 years ago by Steve Friedl, updated 13 years ago by Steve Friedl.

Many applications wish to obtain parts of the URL for the current page (the hostname, the query string, etc.), and the CHttpRequest class wraps various $_SERVER variables to break down the URL into its constituent parts.

28 0
16 followers
Viewed: 19 055 times
Version: 1.1
Category: Tips
Tags: request, URL

Code style

Created 13 years ago by zaccaria, updated 13 years ago by g3ck0.

Often, when writing widgets or editing Yii code, it is unclear whether or not the code is following the MVC pattern.

29 0
7 followers
Viewed: 27 777 times
Version: 1.1
Category: Tips
Tags: mvc

Extending common classes to allow better customization

Created 13 years ago by Steve Friedl, updated 13 years ago by Steve Friedl.

The two most commonly-used base classes in most Yii applications are CController and CActiveRecord, each extended to your own particular models and controllers.

36 0
19 followers
Viewed: 41 365 times
Version: 1.1
Category: Tips
Tags:

Configuring PhpStorm IDE for Yii 1.1

Created 13 years ago by samdark, updated 6 years ago by samdark.
  • Complete code: Ctrl+Space.
  • Show method arguments: Ctrl+Q.
59 1
53 followers
Viewed: 152 632 times
Version: 1.1
Category: Tips
Tags: IDE, PhpStorm

CGridView: Render customized/complex datacolumns

Created 12 years ago by Joblo, updated 11 years ago by Joblo.

If you have to display a overview of related data in a table, you can use the CListView, create your view with table/tr/td tags and implement db-queries in the view to display detaildata of the current (master-)record.

53 0
74 followers
Viewed: 168 135 times
Version: 1.1
Category: Tips
Tags: CGridView

Guidelines for good schema design

Created 12 years ago by Steve Friedl, updated 5 years ago by softark.

Virtually all Yii applications are built on top of a database, and though Yii is very flexible in how it addresses your DB, some design choices make things more convenient than others.

124 0
71 followers
Viewed: 121 526 times
Version: 1.1
Category: Tips