1. Question:How to add external javascript in YII? 

    Answer
    Yii has a special class named CClientScript that can help include scripts, CSS, and other resources in the page.
    In order to include an external JS , you can use the following code:
    Yii::app()->clientScript-> registerScriptFile('http://example.com/js/main.js);

    1. Report
  2. Question:Name the configuration file in YII and where it is located? 

    Answer
    The name of configuration file is main.php and it is located in protected/config/main.

    1. Report
  3. Question:Name the configuration file in YII and where it is located? 

    Answer
    The name of configuration file is main.php and it is located in protected/config/main.

    1. Report
  4. Question:How to activate mysql database driver in yii and in which file you have to work? 

    Answer
    We can active MySql database driver in YII by this way:
    'connectionString' => 'mysql:host=localhost;dbname=yii_sir',
    'username' => 'root',
    'password' => '',
    and we have to work on  protected/config/ database.php

    1. Report
  5. Question:How to import custom classes in yii? 

    Answer
    We can import custom classes in YII by following way:
    <?php Yii::import(“application.Something.Animal/MountDuck”); ?>

    1. Report
  6. Question:Discuss the path aliases in YII? 

    Answer
    Yii uses path aliases extensively. A path alias is associated with a directory or file path.       It is specified in dot syntax, similar to that of widely adopted namespace format: RootAlias.path.to.target                                                                                                               Link: http://www.yiiframework.com/doc/guide/1.0/en/basics.namespace

    1. Report
  7. Question:Name the application types bundled with YII. 

    Answer
    There are two application types bundled with Yii which are as follows:                                             
    1. Web application (CWebApplication)       
    2.  Console application (CconsoleApplication)            
    Both are extended from CApplication, so both console and web applications are sharing its components

    1. Report
  8. Question:Name five important component names in YII.\ 

    Answer
    1.	coreMessages
    2.	db
    3.	messages
    4.	errorHandler
    5.	cache
    6.	format

    1. Report
  9. Question:classes Name some YII core collection. 

    Answer
    1.	Lists: CList, CtypedList
    2.	 Maps: Cmap, CattributeCollection
    3.	 Queue: Cqueue
    4.	Stack: Cstack

    1. Report
  10. Question:How can you configure URL rules in YII? 

    Answer
    To configure URL rules we have to  add the below to our rules in protected/config/main.php:
    'home' => 'site/index',
    'page/<alias>' => 'site/page',
    Save the above changes and browse the following URLs:
     /home
    /page/test	
    Page:39

    1. Report
Copyright © 2024. Powered by Intellect Software Ltd