There are many unclear points by developing any product, to find an answer for them you use Google or follow the advice given by your colleagues, or read manuals.
We would like to help you and to save your time, in case you have the same problems.
The most important are functions of auto-finishing Yii code in IDE:
For example, NetBeans:
Click the right mouse button at the name of the project, choose ‘Properties’ in the context menu (at the bottom).
Then, in the window find a section Php include path, click the button ‘Add folder’ and add the Yii framework root path.
Replacement for common usage of arrays $_REQUEST, $_POST, $_GET:
$request = Yii::app()->request;
Instead of $param = isset($_REQUEST['id']) ? $_REQUEST['id'] : 1; you should use $param = $request->getParam('id', 1);
Instead of $param = isset($_GET['id']) ? $_GET['id'] : null; - $param = $request->getQuery('id');
Instead of $param = isset($_POST['id']) ? $_POST['id'] : 1; - $param = $request->getPost('id', 1);
More useful methods:
Yii::app()->getRequest()->getUrl() - http://monoray.net/forum/index?var=val
Yii::app()->getRequest()->getHostInfo() - http://monoray.net/forum/index?var=val
Yii::app()->getRequest()->getPathInfo() - http://monoray.net/forum/index?var=val
Yii::app()->getRequest()->getRequestUri() - http://monoray.net/forum/index?var=val
Yii::app()->getRequest()->getQueryString() - http://monoray.net/forum/index?var=val
Your message by incorrect output value - attribute message:
The captcha is not updated by incorrect input value – try the following:
'testLimit' is set for the value 3 by default. So the code is updated only after the third incorrect input value.
If you need to update a part of the page by ajax request and upload all the scripts use:
Just the last parameter, which is set as true, says that it is necessary to output the page with all its scripts.
Menu is based on Cmenu, but instead of text (label) an image is needed:
There are two ways:
to add the path to the image in 'label' and install 'encodeLabel' in the value false:
Use template:
Sometimes it is necessary to use the settings (from the configuration file /protected/config/main.php) of the application in Javascript code.
To get the value of any key in the array params it is necessary to add the following code:
So we can output the value that we need: