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


Updated 5 years ago by Darwin WenTips2 comments – viewed 28,089 times – ( +2 / -3 ) – version 1.1
tags: module, Widgets

An easy way to use escopes and CActiveDataProvider

Updated 5 years ago by Rafael GarciaTips8 comments – viewed 27,779 times – ( +1 / -1 ) – version 1.1
Often used scopes to define criteria in our models. This is a very useful feature as it ensures that in any part of application applying the criteria defined by the scope when called it.

An easy way to display a success page using flash messages

Updated 5 years ago by qiangTips2 comments – viewed 37,108 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 28,464 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,774 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 17,287 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 9,020 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,300 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 53,413 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,766 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.