Yii Introduction Tutorials

Yii Maintenance Mode

This tutorial will useful to change your yiiframework website to maintenance mode. User can access maintenance file only.Maintenance ControllerMaintence FileMaintenance ControllerMake or Point the controller action to maintenance mode. return array( 'catchAllRequest'=> array('site/maintenance'), ............ Maintence FileMake or Point the file to maintenance mode. If the condition file_exists() return false, The maintenance mode will be off or not work. 'catchAllRequest'=>file_exists(dirname(__FILE__).'/.maintenance')? array('site/maintenance') : null,... Read More »

Yii Database Connection

Most Web applications have the databases. We have to configure the database details in protected/cofig/main.php to use the database. Here i explained with two types of database connectivity. They are application configuration connection, CDbConnection .Application Configuration (config/main.php)Sqlite DatabaseTo connect the sqlite db with application, we need the directory details of database. 'db'=>array( 'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db', ), Mysql DatabaseTo connect the mysql db with application, we need the hosting details, database […]... Read More »

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 »