Question: What is Yii?
Yii is a PHP framework which is based on MVC (Model View Controller).
Question: Is it opensource?
Yes, It is opensource. Download and use as per your project requirement. Question: What is full form of Yii
Yes it is.
Question: In which language, It is written?
PHP.
Question: What is current stable version of Yii?
Version: 2.0.7 dated February 14, 2016.
Question: What is offical website of Yii Framework?
http://www.yiiframework.com
Question: From where i an download Yii Framework?
http://www.yiiframework.com/download
Question: How to start Yii?
http://www.yiiframework.com/tour
Question: What are main feature of Yii framework?
- MVC design pattern
- Web Service available for Apps like android
- Internationalization and localization translation for multilingual.
- Caching for speed up the application
- Error handling and logging for tracking
- cross-site scripting (XSS), cross-site request forgery (CSRF) protection
- PHPUnit and Selenium for testing.
- Automatic code generation help us to fast development.
Question: How to set default controller on Yii?
array( 'name'=>'Yii Framework', 'defaultController'=>'site', );
Question: How to get current controller id?
echo Yii::app()->controller->id;
Question: How to get current action id?
echo Yii::app()->action->id;
Question: What is the first function that gets loaded from a controller? ?
index
Question: How can we use ajax in Yii?
use ajax helper
Question: What are two type of models in YII
- Form models
- active records
Question: What are active records model?
Active Record is a design pattern used to abstract database access in an object-oriented way.
active records model is based on this design pattern.
Question: How to define a form model?
class MyLoginForm extends CFormModel { public $username; public $password; public $rememberMe=false; }
Question: How to set validation in Form Model?
class MyLoginForm extends CFormModel { public $username; public $password; public $rememberMe=false; private $_identity; public function rules() { return array( array('username, password', 'required'), array('rememberMe', 'boolean'), array('password', 'authenticate'), ); } public function authenticate($attribute,$params) { $this->_identity=new UserIdentity($this->username,$this->password); if(!$this->_identity->authenticate()) $this->addError('password','username or password Incorrect .'); } }
Question: What are the core application components available on Yii?
- db- database connection.
- assetManager - manage the publishing of private asset files
- authManager - manage role-based access control
- cache- manage caching functionality
- clientScript- manage javascript and CSS
- coreMessages- provides translated core messages
- errorHandler- manage errors handling.
- themeManager- Manage themes
- urlManager- URL parsing and creation functionality
- statePersister- mechanism for persisting global state
- session- Session management
- securityManager- Security Managment