Yii URL Tutorials

Yii CApplication ->Yii::app()

CApplication is the base class for all application classes. It contains global variables, functions etc. Here i added some most reused functions and properties of yii capplication. Simply we will call this “Yii::app()”Properties/ FunctionsOutputYii::app()->nameMy Web ApplicationYii::app()->basePathD:\wamp\www\yiiapi\protectedecho Yii::app()->baseUrl/yiiapiYii::app()->homeUrl/yiiapi/index.phpYii::app()->id3fe52c6cYii::app()->languageen_usYii::app()->timeZoneUTCYii::app()->localeDataPathD:\wamp\www\yiiapi\yiiframework\framework\i18n\dataYii::app()->createAbsoluteUrl(“/”)http://127.0.0.1/yiiapi/index.phpYii::app()->createUrl(“/”)/yiiapi/index.phpYii::app()->getBasePath()D:\wamp\www\yiiapi\protectedYii::app()->getBaseUrl()/yiiapiYii::app()->getHomeUrl()/yiiapi/index.phpYii::app()->getId()3fe52c6cYii::app()->getLanguage()en_usYii::app()->getTimeZone()UTCYii::app()->setBasePath()Yii::app()->setHomeUrl()Yii::app()->setId()Yii::app()->setLanguage()Yii::app()->SetTimeZone()Asia/Calcutta... Read More »

Loginurl In Yii

Here i added the code to “how to set default login url in yii”config/main.php ............... 'components'=>array( 'user'=>array( 'class' => 'WebUser', 'loginUrl' => array('user/login'), ), ), .................. Read More »

Home page URL in Yii

Here i added the code to “how to set and get the home page url in yii”Set Home Page UrlGet Home Page UrlSet Home Page Url ............... 'homeUrl'=>array('user/index'), 'components'=>array( ............... ), ............... Get Home Page Url $homeurl=Yii::app()->homeUrl; //redirect home page Yii::app()->request->redirect(Yii::app()->homeUrl);... Read More »

Yii Current Url

To Get Current UrlGet Action NameGet Controller NameTo Get Current Urlecho Yii::app()->request->requestUri; Get Action Name//Anywhere Yii::app()->controller->action->id //Inside Controller public function beforeAction($action) { $actionId = $action->id; .......... } Get Controller Name// Anywhere Yii::app()->controller->id //Inside Controller echo $this->getId();... Read More »