Wiki

Articles in category "tips", sorted by ratingX
Displaying 61-70 of 154 result(s).

View a related field in CGridView

Created 3 years ago by rafaelt88Tips1 comment – viewed 11,198 times – ( +6 / -1 ) – version 1.1
Generally we need to show one or more fields from a model that is related to another model used in CGridView. For our case we will use two related models, which explain how to use model "A" fields in a CGridView that used model "B".

Saving files to a blob field in the database

Created 6 years ago by zaccariaTips8 comments – viewed 57,784 times – ( +9 / -3 ) – 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

Boost composer-asset-plugin update speed

Created about a year ago by schmunkTips5 comments – viewed 9,318 times – ( +5 / -1 ) – version 2.0
If you're using a lot of bower and npm assets with Yii 2.0 you might encounter long running composer update tasks.

Extending CActiveForm for some form display fixes and language tweaks

Created 6 years ago by TrejderTips0 comments – viewed 17,123 times – ( +5 / -1 ) – version 1.1
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.

CGridView customized CCheckBoxColumn

Created 3 years ago by chandranTips2 comments – viewed 12,605 times – ( +5 / -1 ) – version 1.1
Hi friends,

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

Created 4 years ago by le_topTips0 comments – viewed 6,764 times – ( +5 / -1 ) – version 1.1
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 giving me a head start to do what I wanted: patching third party code without touching the original to allow easy upgrades.
tags: patch, patching

using jqbargraph to create beautiful graphs

Created 4 years ago by MAHESH.E.UTips1 comment – viewed 8,498 times – ( +5 / -1 ) – version 1.1
If you are about to create a graph, the best option i would suggest is the jqbargraph.

CGridView: Adding behaviors from configuration, and template items from behaviors to CGridView

Created 4 years ago by le_topTips0 comments – viewed 9,814 times – ( +5 / -1 ) – version 1.1
Changing the way a CGridView is rendered from the configuration file, or through behaviors specified at the moment it is used, is handy to extend a CGridView without creating tons of different classes for it. I am surprised that this is not in the default implementation, so I made my default CGridView implementation.

Debugging CActiveRecord failed save() attempts

Created 4 years ago by BoazTips0 comments – viewed 22,598 times – ( +5 / -1 ) – version 1.1
When you're filling up a form of a CActiveRecord (using CActiveForm for example), usually you'll construct your code so that in case of validation error you'll get back the form with the error displayed back to you, typically when CActiveForm.errorSummary() is used. This is how its done by Gii.

Putting Function To Be Called In View

Created 6 years ago by junxiongTips2 comments – viewed 36,110 times – ( +6 / -2 ) – version 1.1
Sometimes we need some complicated view to be displayed (such as generating complicated table). Most people suggest that in MVC the View must be as simple as possible (don't have too much loops, etc). So what we have to do is to hide away the complex code by putting it at somewhere else. The following are few places options to keep the function:
tags: view, render