Wiki articles in category Tips

Showing 141-158 of 158 items.

Getting nulls from database instead of empty strings

Created 8 years ago by samdark, updated 8 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: 15 323 times
Version: 1.1
Category: Tips
Tags: database, null

How to ensure unicity to url

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

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

13 0
17 followers
Viewed: 18 223 times
Version: 1.1
Category: Tips
Tags: SEO, unique, URL
14 0
20 followers
Viewed: 48 791 times
Version: 1.1
Category: Tips

Special $variables in CGridView and CListView

Created 8 years ago by Steve Friedl, updated 8 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.

22 1
33 followers
Viewed: 72 029 times
Version: 1.1
Category: Tips

1:n relations sometimes require CDbCriteria.together

Created 8 years ago by fsb, updated 6 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: 46 151 times
Version: 1.1
Category: Tips

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

Created 7 years ago by kiran sharma, updated 6 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
38 followers
Viewed: 195 002 times
Version: 1.1
Category: Tips

htmlOptions explained for various controls.

Created 9 years ago by Woil, updated 9 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: 61 579 times
Version: 1.1
Category: Tips

Understanding series articles

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

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

16 0
13 followers
Viewed: 11 462 times
Version: 1.1
Category: Tips

Using cache in CActiveDataProvider

Created 8 years ago by Stamm, updated 8 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: 25 038 times
Version: 1.1
Category: Tips

Reading the doc

Created 9 years ago by zaccaria, updated 9 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: 9 772 times
Version: 1.1
Category: Tips
Tags: doc

An easy way to display a success page using flash messages

Created 8 years ago by qiang, updated 8 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: 48 330 times
Version: 1.1
Category: Tips

Adding Yii Search to Your Browser Search Box

Created 9 years ago by qiang, updated 2 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: 51 489 times
Version: all
Category: Tips

URL component access functions

Created 9 years ago by Steve Friedl, updated 9 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: 16 176 times
Version: 1.1
Category: Tips
Tags: request, URL

Code style

Created 9 years ago by zaccaria, updated 9 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: 22 486 times
Version: 1.1
Category: Tips
Tags: mvc

Extending common classes to allow better customization

Created 9 years ago by Steve Friedl, updated 9 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: 34 965 times
Version: 1.1
Category: Tips
Tags:

Configuring PhpStorm IDE for Yii 1.1

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

CGridView: Render customized/complex datacolumns

Created 8 years ago by Joblo, updated 7 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
75 followers
Viewed: 161 852 times
Version: 1.1
Category: Tips
Tags: CGridView

Guidelines for good schema design

Created 8 years ago by Steve Friedl, updated a year 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.

123 0
71 followers
Viewed: 102 464 times
Version: 1.1
Category: Tips