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.
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.
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:
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:
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.
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:
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.
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:
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:
If you are lucky enough and have the privilege to develop on a Linux based environment, this little tip might boost-up your TDD process (at least the Unit Testing part). Please note, that this should work just fine with Apple computers also, but not tested!
Developing custom Grids and ListViews for my new CMS I was facing a small challenge: If I was to update/delete/batch delete items of my Grid, how would I return to the current page view?
ChromePHP is a console logging extension for Google Chrome.
In this simple example I'll demonstrate how to extend CActiveForm class to overload some drawing functions to achieve some commonly used fixes in forms.
Here is overloaded version of CActiveForm.labelEx that adds colon (:) at the end of text of label with respecting CHtml::$afterRequiredLabel and CHtml::$beforeRequiredLabel
The default behavior with radio button lists is ugly, and I figured out mostly how to style them a coupla different ways. I'll used the blog tutorial example (but with my own posting modes):
Many people want to use downloaded extensions in their own way. As for me most of the extensions require me to correct Yii::import()
instructions inside their source code. All these extensions are directory dependent. To avoid the situation described above, I suggest to implement pseudo-anonymous aliases:
// take the curr...
Often, when writing widgets or editing Yii code, it is unclear whether or not the code is following the MVC pattern.
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.
Almost all the information you need whilst working with yii is written in the Class Reference.
Often happens to have the need of change a part of the page with ajax.
I have a calls which help me display json directly in html table.