Wiki

Sorted by commentsX
Displaying 61-70 of 467 result(s).

Manage (Target) Language in Multilingual Applications + A Language Selector Widget (i18n)

Created about a year ago by c@cbaTutorials9 comments – viewed 14,526 times – ( +9 )
In case of a multilingual application, one might consider it a reasonable approach to store the preferred language of the user in a session variable, and after that, every time a page is requested, to check this session variable and render the page in the indicated language. This tutorial shows a Yii-way of doing this. We implement an event handler for the onBeginRequest event; as the name of the event suggests, this event handler will be called at the beginning of each request, so its a good place to check whether a language is provided (via post, session or cookie) and set the application language accordingly. We also implement a simple Language-Selector Widget, which can render the language options as ajax-links or as a drop-down list.

Add information to Yii::app()->user by extending CWebUser

Created 3 years ago by atrandafirTutorials9 comments – viewed 53,895 times – ( +26 )
This little tutorial explains a way how you can retrieve more parameters from Yii::app()->user by adding a component that extends CWebUser and retrieves the user information from database table named User.

Display an AJAX tree from your DB using CTreeView

Created 3 years ago by François GannazTutorials9 comments – viewed 26,796 times – ( +20 )
This example uses a MySQL DB with a table named tree with the fields id, name, and parent_id. The parent_id will be NULL for root elements. The SQL is kept simple (no autoinc, no FK, etc).
tags: AJAX, CTreeView

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

Created 10 months ago by kiran sharmaTips9 comments – viewed 29,984 times – ( +19 )
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)

Drills : Search by a HAS_MANY relation

Created 5 months ago by softarkTutorials9 comments – viewed 7,558 times – ( +20 )
Sometimes we get lost trying to search by a HAS_MANY relation using CActiveRecord or CActiveDataProvider. This article is a series of drills that try to describe the practical techniques of searching by a HAS_MANY relation.

Implementing a User Level Access System

Created 2 years ago by Antonio RamirezTutorials9 comments – viewed 26,179 times – ( +27 )
I would like to provide you a quick tip on how to implement user level access to your Yii applications.

Local time zones and locales

Created about a year ago by Russell EnglandHow-tos9 comments – viewed 30,089 times – ( +12 / -2 )
Following on from international dates, I also wanted times in the local timezone and format. This was a little more tricky but I think I've got a solution. This is only really appropriate if you have an international app.

How to show ajax delete status in CGridView like flash messages

Created about a year ago by hasanaviHow-tos9 comments – viewed 18,559 times – ( +16 )
I've seen many tickets regarding how to show friendly delete confirmation using CGridView's CButtonColumn in ajax request. If you are using relational database, after producing CRUD functionality when you try to delete a record in ajax mode which has child record it can't be deleted and you can see the ajax loader forever. By this way you can't show the users if a record has been successfully deleted or if there are some problem in flash style (setFlash() / getFlash())

Using counters with ActiveRecord

Created about a year ago by davi_alexandreTips8 comments – viewed 9,804 times – ( +9 / -1 )
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).

Use shortcut functions to reduce typing

Created 4 years ago by qiangTutorials8 comments – viewed 27,153 times – ( +47 )
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 the problem of these lengthy typings, it is worthwhile to define global shortcut functions to some commonly used method calls. They will make the application code look cleaner.