Wiki

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

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

Created 2 years ago by le_topTips0 comments – viewed 4,451 times – ( +5 ) – 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 2 years ago by MAHESH.E.UTips1 comment – viewed 6,441 times – ( +5 ) – 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 2 years ago by le_topTips0 comments – viewed 7,364 times – ( +5 ) – 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 about a year ago by BoazTips0 comments – viewed 13,344 times – ( +5 ) – 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.

Use application on production/development environment without making changes

Created 3 years ago by ifdatticTips3 comments – viewed 35,112 times – ( +8 / -1 ) – version 1.1
I like programing on my localhost, however it really bugged me to make changes to index.php & config files on my production server. After combining all available wiki articles on this topic and some trial and error this is what I use for my applications so I could just upload it to production server and it will work without any changes.

An important tip when you are using CArrayDataProvider.

Created 2 years ago by sirin kTips0 comments – viewed 8,758 times – ( +8 / -1 ) – version 1.1
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 error like “yourmodel.id is not defined”.

Update two models with one view

Created 3 years ago by sensorarioTips11 comments – viewed 34,479 times – ( +10 / -2 ) – version 1.1
Suppose to have two models: Users and Emails. You do not want to store email in a Users model. And User can have 0 or many emails. This is the form generated to create a new user (just username).
tags: database, model, view, form

Saving files to a blob field in the database

Created 4 years ago by zaccariaTips8 comments – viewed 45,689 times – ( +9 / -2 ) – 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

Managing constants easily

Created 3 years ago by briiC.lvTips4 comments – viewed 11,783 times – ( +4 ) – version 1.1
For time to time i have models with constants (basicly status constants) which i use in diferent places and if these constant changes, i have to change mentions of constant in code elsewhere.

Create thermometer using rgraph

Created about a year ago by Ankit ModiTips2 comments – viewed 5,203 times – ( +4 )
Hi friends,