Difference between #1 and #2 of YiiFunctions - Helper file, a collections of Yii function to make the Yii coding shorten

unchanged
Title
YiiFunctions - Helper file, a collections of Yii function to make the Yii coding shorten
unchanged
Category
Tutorials
unchanged
Tags
Yii coding shorten
changed
Content
YiiFunctions
============

Helper file, a collections of Yii function to make the Yii coding shorten.

The goal of this file is to make more simplication and new way of coding design.

- How to install this file ?
<br />
Steps:
<br />
    1 ) For you to able to organize the location of the directory, create a
subfolder under the 'protected' folder name 'functions'
    
    2 ) On the index.php, insert the line
~~~
[php]
require_once(dirname(__FILE__) . '/protected/functions/yii.php');
    
// before the line.

Yii::createWebApplication($config)->run();

~~~
	
Example:
~~~
[php]

// change the following paths if necessary
$yii=dirname(__FILE__).'/1.1.9/framework/yii.php';
$config=dirname(__FILE__).'/1.1.9/protected/config/main.php';

// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
			
require_once(dirname(__FILE__) . '/protected/functions/yii.php'); // I insert
this new line for my index.php file
			
require_once($yii);
Yii::createWebApplication($config)->run();
~~~
        
3 ) That's all, you're now finish installing the functions.
        
- How to use ? 
<br />
Benefits below:

~~~
[php]
// Before
Yii::app()->

// Now
webapp()->
~~~	
	

~~~
[php]
// Before
Yii::app()->params['params1']['params2']['params3']
	
// Now
params('params1.params2.params3')
~~~	


~~~
[php]
// Before
CHtml::link($text, $url, $htmlOptions);
	
// Now 
hyperlink($text, $url, $htmlOptions)
~~~


You may download it here :
[https://github.com/ersongit/YiiFunctions](https://github.com/ersongit/YiiFunctions![https://github.com/ersongit/YiiFunctions](https://github.com/ersongit/YiiFunctions
"https://github.com/ersongit/YiiFunctions")
Write new article