Wiki articles

Showing 101-120 of 651 items.

Using counters with ActiveRecord

Created 12 years ago by davi_alexandre, updated 9 years ago by marcovtwout.

Let's say, for example, that you are developing a blog or some kind of CMS and you want to track the number of times each post was viewed (maybe to show a list of the most viewed ones).

11 1
17 followers
Viewed: 44 620 times
Version: 1.1
Category: Tips

Exporting CGridView results to CSV file

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

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.

6 3
18 followers
Viewed: 69 416 times
Version: 1.1
Category: Tutorials

Creating a database-driven hierarchical Structure combined with CMenu and superfish

Created 14 years ago by thyseus, updated 12 years ago by thyseus.

Note: Please also take a look at the newer EMenu extension. This works even better that the deprecated CDropDownMenu!

15 0
24 followers
Viewed: 62 976 times
Version: 1.1
Category: Tutorials
Tags: menu

Caching strategy

Created 10 years ago by darkheir, updated 10 years ago by CeBe.

Note: Before reading this wiki you should have read the caching part in the Yii guide

3 1
12 followers
Viewed: 11 795 times
Version: 1.1
Category: How-tos

Storing your images in your table's blob field and displaying that stored images.

Created 11 years ago by sirin k, updated 6 years ago by Maurizio Domba Cerin.

He im giving you a very simple example ie how you can store an image to your blob field in a table.Hope you already familiar with the normal image upload.

8 2
11 followers
Viewed: 48 483 times
Version: 1.1
Category: How-tos
Tags: blob, image

Using phpseclib with Yii

Created 11 years ago by nkd, updated 11 years ago by nkd.

I installed phpseclib because I needed to do some AES encryption in my project. After all the hassle of installing php lib, I found out that Yii already has a security module (securityManager). I finally decided to keep using phpseclib because it has one big advantage over Yii securityManager module, it does...

0 0
6 followers
Viewed: 19 059 times
Version: 1.1
Category: How-tos
Tags: security

Relations: BELONGS_TO versus HAS_ONE

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

It's very common to see new Yii users confusing the relations HAS_ONE and BELONGS_TO, and getting it wrong means you won't get proper values back. And though we'll talk about HAS_MANY as well, we're specifically omitting the MANY_MANY relation because it's a whole different animal.

56 0
35 followers
Viewed: 163 016 times
Version: 1.1
Category: FAQs

How to generate Yii-like Documentation

Created 12 years ago by Asgaroth, updated 11 years ago by fsb.

Something a good application cant miss is documentation, and what would be better than some nice formatted HTML documentation that can be auto-generated from your code, we know several tools that already do this like phpDocumentor, but today we are introducing Yii Docs Generator...

41 0
42 followers
Viewed: 47 853 times
Version: 1.1
Category: How-tos
Tags: doc

Local time zones and locales

Created 12 years ago by Russell England, updated 12 years ago by Russell England.

The sql 'set time_zone' ensures that all dates retrieved are in UTC time. If your MySql server has the time zone names installed then use 'UTC' instead of '+00:00'.

Components

Copy the code at the end of this wiki for LocalTime.php and DefaultDateTimeParser.php int...

13 2
23 followers
Viewed: 99 711 times
Version: 1.1
Category: How-tos

[Updated] How to create & call custom global function in whole application?

Created 9 years ago by Rohit Suthar, updated 9 years ago by Rohit Suthar.

In this wiki I will show how to create own custom global function. It may be save the space and reduce the time.

1 3
5 followers
Viewed: 36 693 times
Version: 1.1
Category: Tutorials

How to use the official Yii installer for Composer (**DEPRECATED**)

Created 11 years ago by br0sk, updated 10 years ago by br0sk.

This wiki shall be considered deprecated since the Yii installer for composer has been discontinued.

3 0
10 followers
Viewed: 54 342 times
Version: 1.1
Category: How-tos

How to use single form to collect data for two or more models (CActiveForm and Ajax Validation edition)

Created 12 years ago by RusAlex, updated 12 years ago by Darwin Wen.

With Yii you can use one CActiveForm for collecting data for two or more models with ajax validation and client validation.

16 0
33 followers
Viewed: 72 441 times
Version: 1.1
Category: How-tos

Yiinitializr: The Library

Created 10 years ago by Antonio Ramirez, updated 10 years ago by Antonio Ramirez.

Yiinitializr\Helpers\Initializer::create('./../', 'frontend', array(

// will override frontend configuration file
__DIR__ .'/../../common/config/main.php', // merged with
__DIR__ .'/../../common/config/env.php', // merged with
__DIR__ .'/../../common/config/local.php' // merged with

))->run(); `

Yiinitializr\Cli namespace

This namespace brings utilities to interact with...

14 0
23 followers
Viewed: 26 497 times
Version: 1.1
Category: Others

Filter / Search with CListView

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

This is what I did. Its the EASIEST solution that I know of. I just reused the advanced search done in CGridView.

22 0
26 followers
Viewed: 55 313 times
Version: 1.1
Category: How-tos

How to upload a file using a model

Created 15 years ago by qiang, updated 8 years ago by samdark.

First declare an attribute to store the file name in the model class (either a form model or an active record model). Also declare a file validation rule for this attribute to ensure a file is uploaded with specific extension name.

66 4
64 followers
Viewed: 516 928 times
Version: 1.1
Category: Tutorials

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

Created 10 years ago by Kostas Apazidis (KonApaz), updated 9 years ago by Kostas Apazidis (KonApaz).

Everyone have seen a multilayer menu in several CMS

7 0
8 followers
Viewed: 26 961 times
Version: 1.1
Category: How-tos

How to use bizRules in standard accessControl filter

Created 10 years ago by Maciej Liżewski, updated 9 years ago by Maciej Liżewski.

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.

3 0
8 followers
Viewed: 20 900 times
Version: 1.1
Category: How-tos

Accessing data in a join table with the related models

Created 12 years ago by fsb, updated 11 years ago by krowe.

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.

16 1
30 followers
Viewed: 146 497 times
Version: 1.1
Category: How-tos

Use shortcut functions to reduce typing

Created 14 years ago by qiang, updated 11 years ago by Yang He.

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...

46 0
45 followers
Viewed: 66 715 times
Version: 1.1
Category: Tutorials
Tags:

custom sql query results to CDetailView

Created 10 years ago by Kostas Apazidis (KonApaz), updated 9 years ago by Rohit Suthar.

This is a bried guide about displaying of custom sql query results.

3 0
4 followers
Viewed: 45 175 times
Version: 1.1
Category: How-tos