Wiki articles in category Tips

Showing 21-40 of 158 items.

Reading the doc

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

Extending CActiveForm for some form display fixes and language tweaks

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

In this simple example I'll demonstrate how to extend CActiveForm class to overload some drawing functions to achieve some commonly used fixes in forms.

The colon

Here is overloaded version of CActiveForm.labelEx that adds colon (:) at the end of text of label with respecting CHtml::$afterRequiredLabel and CHtml::$beforeRequiredLabel

5 0
6 followers
Viewed: 19 324 times
Version: 1.1
Category: Tips

Yii behind a reverse proxy, SSL support and correct IP logging

Created 6 years ago by mrkmg, updated 6 years ago by mrkmg.

If you are hosting Yii behind a reverse proxy, for example nginx, and you are having issues with your logs showing the proxies IP, or the urls being created arn't being created for SSL because your SSL certs are located on your reverse proxy instead of the Yii server, this code may be able to help you. I placed them in the very top of Yii's entry script, index.php

0 0
2 followers
Viewed: 10 075 times
Version: 1.1
Category: Tips

Custom Archive in Blog system

Created 6 years ago by nirmalroka, updated 6 years ago by nirmalroka.

Hi I had made simple archive system for blog system that can handle tbl_post. I had used simple CDbCriteria not more than that. I know there is more and many better way to this but I think this will give some idea to users to generate new idea or customized or modified this version of code.

1 0
2 followers
Viewed: 7 479 times
Version: 1.1
Category: Tips

ChromePHP for Yii

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

ChromePHP is a console logging extension for Google Chrome.

3 1
4 followers
Viewed: 14 901 times
Version: 1.1
Category: Tips

Get notified about the status of a Facebook user in your web app using periodic Ajax calls.

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

hello,

 This article is helpful only if you have the following situation:
 A web app which uses facebook login to login its users and if a user is logged out from his/her facebook account through another browser tab, then your app dont know that he is logged out  out or not from his facebook account and he/she will remain as logged in your web application.Its ok if you have no problem wi...
4 0
6 followers
Viewed: 9 792 times
Version: 1.1
Category: Tips
Tags: facebook, user

Extending common classes to allow better customization

Created 8 years ago by Steve Friedl, updated 8 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: 33 871 times
Version: 1.1
Category: Tips
Tags:

Solution for session lose of Facebook iframe application in Internet Explorer .

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

Facebook iframe app’s session is losing in Internet Explorer when doing a second redirection inside the facebook iframe app.The main reason is ,by default IE wont allow cookies in its priavacy settings If cookies not available means session is also not available for our Facebook iframe app in IE.

2 0
4 followers
Viewed: 9 970 times
Version: 1.1
Category: Tips

An important tip when you are using CArrayDataProvider.

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

Yii's CArrayDataProvider is very helpful to display model relation data's directly on it.But it is truely a confusing one because by default it will assume a table field named “id” as primary key for its pagination purpose and what if you dont have field named “id” as primary key on your table? so its truely confusing and if you tried to display without an “id” field on ur table you will get an...

5 1
5 followers
Viewed: 15 772 times
Version: 1.1
Category: Tips

Auto-update denormalized attributes with MongoDb and Yii2

Created 5 years ago by edoardo849, updated 5 years ago by CeBe.

You have different collections in MongoDb with de-normalized attributes. As you may know, due to its not-join nature, MongoDb tends to encourage repetition of the same value in different collections (de-normalization). In this MongoDb is opposed to a more SQL-like approach where you usually reference only the ID of the value with a foreign key.

1 0
3 followers
Viewed: 12 100 times
Version: 2.0
Category: Tips

[pt-br] O guia de estudos do Yii para iniciantes

Created 6 years ago by Rodrigo Coelho, updated 6 years ago by Rodrigo Coelho.

You can find the english version of this wiki here: The complete beginner's study guide for the Yii Framework.

1 0
3 followers
Viewed: 10 997 times
Version: 1.1
Category: Tips
Tags:

Setting static modules' properties in config

Created 6 years ago by Alexander Palamarchuk, updated 6 years ago by Alexander Palamarchuk.

You may face a situation when you need to access to a configurable module's property from everywhere and you don't have an instance of this module's class.

1 1
2 followers
Viewed: 11 225 times
Version: 1.1
Category: Tips
Tags: config, module

My Own Components Folder in Yii2

Created 5 years ago by CTala, updated 5 years ago by CTala.

In Yii1 I used to have my own components under the components folder of the structure, now with namespacing this is a little bit different.

2 1
2 followers
Viewed: 14 567 times
Version: 2.0
Category: Tips

Locking your Yii 2 project package versions with composer.lock

Created 5 years ago by Kartik V, updated 5 years ago by Kartik V.

Ok, you have installed a Yii 2 basic or advanced app for the first time and completed the post install steps. You have picked up a few extensions to install for the first time as well. You would already see a composer.lock file in your application root folder.

0 2
37 followers
Viewed: 9 724 times
Version: 2.0
Category: Tips

Install specific Yii2 vendor extension & dependency without updating other packages.

Created 5 years ago by Kartik V, updated 5 years ago by Kartik V.

The tips here are for advanced usages of composer and its assumed you have read about using composer and have a knowledge of your vendor packages to be updated. Let's consider, you want to update only one specific yii2 vendor library, without updating all the other extension packages?

2 3
39 followers
Viewed: 27 939 times
Version: 2.0
Category: Tips

Speedup unit tests by moving MySql data to memory (in Ubuntu)

Created 6 years ago by seb, updated 6 years ago by François Gannaz.

There are several ways to speedup slow unit tests which interact with database:

1 1
3 followers
Viewed: 17 303 times
Version: 1.1
Category: Tips

Make an ajax request to another server using JSONP

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

There are cases that you want to make an ajax request to another server and get the results.

1 0
2 followers
Viewed: 10 522 times
Version: 1.1
Category: Tips

Model validation for field ranges using yii2-field-range extension

Created 5 years ago by Kartik V, updated 5 years ago by Kartik V.

The yii2-field-range extension enables you to easily setup ActiveField range fields with Bootstrap styling. You basically can setup two attributes joined together like a single field with combined validation error block.

0 0
37 followers
Viewed: 19 420 times
Version: 2.0
Category: Tips

Patching PHP code (used as a library) without changing the original code!

Created 6 years ago by le_top, updated 6 years ago by le_top.

The article Fixing extensions without modifying their code reminded me of another patching technique that I used. My conviction and a hard look on the web had led me to an article [Redefine PHP class methods or class](http://stackoverflow.com/questions/137006/ph...

4 0
5 followers
Viewed: 8 571 times
Version: 1.1
Category: Tips

BaseModuleAR class with MultiActiveRecord

Created 8 years ago by dinhtrung, updated 7 years ago by Gustavo.

MultiActiveRecord is an extension that add support for multiple database connection for your application.

2 0
0 follower
Viewed: 11 219 times
Version: 1.1
Category: Tips