Wiki

Articles in category "tips", sorted by ratingX
Displaying 21-30 of 141 result(s).

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

Created 2 years ago by kiran sharmaTips17 comments – viewed 100,580 times – ( +35 / -3 ) – version 1.1
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)

CGridView: Update/create records in a CJuiDialog

Created 3 years ago by JobloTips11 comments – viewed 38,501 times – ( +14 ) – version 1.1
My article Display the full record in a CJuiDialog uses ajax to view a record in dialog on clicking the 'view-icon'.

Real Time Logging

Created 3 years ago by lucifuriousTips3 comments – viewed 19,521 times – ( +14 ) – version 1.1
I've seen a lot of people asking about the logging facilities in Yii and thought I'd share a nice little class I wrote that provides near real-time logging.

How to ensure unicity to url

Created 3 years ago by zaccariaTips3 comments – viewed 10,702 times – ( +14 ) – version 1.1
Many time for SEO porpouses is important that each page will have a unique address.
tags: SEO, unique, URL

Customizing Yii's formatting rules (extending CFormatter)

Created 3 years ago by HaenselTips0 comments – viewed 13,367 times – ( +14 ) – version 1.1
CFormatter is one of Yii's core components and used to format values displayed in widgets like CGridView or CDetailView. All classic formats like numbers, text, urls or datetime are supported but you may have to use a formatting rule that isn't built in. Let's say we want to display arrays of strings (like tags associated with a product model). When using CDetailView we would usually make use of PHPs implode function to create a simple string value of all values in the $product->tags array.

Getting nulls from database instead of empty strings

Created 3 years ago by samdarkTips2 comments – viewed 9,312 times – ( +13 ) – version 1.1
To get null from database instead of empty strings you need to set up your DB connection as follows:
tags: database, null

Display a nice exception message on ajax requests

Created 3 years ago by Maurizio Domba CerinTips3 comments – viewed 27,169 times – ( +13 ) – version 1.1
When an exception is thrown in our code like
tags: error, exception

Adding a date range search for CGridView the easy way

Created about a year ago by mikewalenTips4 comments – viewed 17,692 times – ( +12 ) – version 1.1
After a lot of research, everything I found on adding date range searching to a CGridView advanced search form seemed to involve adding two new public variables (e.g. $date_from, $date_to), 'safe' rules for the new variables, and a rather chunky if/elseif/else check in the search() method. This probably isn't a hassle for most, but because many of the tables in my database contain two or three and sometimes four date columns (e.g. date_created, date_modified, date_deleted etc.), it meant I was having to add up to eight public variables, the corresponding safe rules, and modifying the search() criteria for each date attribute. So, I set about creating a better way and I thought I'd share my work with the community.

Change buttons on our CGridView extending yii

Created 2 years ago by sensorarioTips5 comments – viewed 23,830 times – ( +11 ) – version 1.1
In this tip, I'll help you to change in few second buttons of your CGridView. I hope you like it =).

Using CListView to display items next to each other (in columns)

Created about a year ago by thyseusTips3 comments – viewed 9,368 times – ( +11 )
When using CListView to display multiple views next to each other, we can use the $index variable inside the viewFile to achieve this. As far as i know there is no extension or out-of-the-box functionality for this, so we need to apply a little hack: