Wiki

Articles in category "tips", sorted by date (updated)X
Displaying 131-140 of 151 result(s).

An easy way to display a success page using flash messages

Updated 5 years ago by qiangTips2 comments – viewed 35,570 times – ( +28 ) – version 1.1
We often need to display a success page after the user has submitted a form without problem. We may show some welcome message after a user registers a new account. There are many ways to implement this workflow. In this article, I will explain a method that exploits flash messages.

Extending common classes to allow better customization

Updated 5 years ago by Steve FriedlTips0 comments – viewed 27,815 times – ( +44 ) – version 1.1
The two most commonly-used base classes in most Yii applications are CController and CActiveRecord, each extended to your own particular models and controllers.

URL component access functions

Updated 5 years ago by Steve FriedlTips1 comment – viewed 12,468 times – ( +28 ) – version 1.1
Many applications wish to obtain parts of the URL for the current page (the hostname, the query string, etc.), and the CHttpRequest class wraps various $_SERVER variables to break down the URL into its constituent parts.
tags: URL, request

Using jQuery UI 1.8.10 themes with Yii 1.1.6

Updated 5 years ago by samdarkTips7 comments – viewed 16,988 times – ( +2 ) – version 1.1
When using the latest stable jQuery UI themes (1.8.10) with Yii 1.1.6 (which uses 1.8.6) the widgets don't appear (they're invisible but they're there). In order to make them visible you need to change the following line:

Functional tests independing from your urlManager settings

Updated 5 years ago by RusAlexTips1 comment – viewed 8,817 times – version 1.1
If you are testing your app and use urlManager in your config, sometimes you will find a problem: you want to test your site independing from urlManager settings. in that way you need to extend your WebTestCase class by this method:

Preventing CJuiTabs from hiding drop-down CMenu items

Updated 5 years ago by RusAlexTips1 comment – viewed 10,050 times – ( +4 ) – version 1.1
Almost all Yii applications use CMenu at the top of each page to show options available to the user, and many include drop-down components to allow more fine-grained selection.

htmlOptions explained for various controls.

Updated 5 years ago by WoilTips1 comment – viewed 52,344 times – ( +18 ) – version 1.1
Most controls that are rendered by CHtml have an argument called $htmlOptions. This argument is an array that holds the attributes of the HTML element. For example the following code:

Real Time Logging

Updated 5 years ago by lucifuriousTips3 comments – viewed 24,063 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.

Yii code completion and calltips in Komodo Edit

Updated 5 years ago by weiTips1 comment – viewed 11,299 times – ( +6 ) – version 1.1
My favourite editor is Komodo Edit (free and crossplatform) and I use it for my everyday coding work. Just recently I found out how to make it help me to work with Yii. :) So follow these steps:
tags: Komodo Edit

Putting Function To Be Called In View

Updated 5 years ago by junxiongTips2 comments – viewed 33,078 times – ( +6 / -1 ) – 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