1. Question:Discuss the format of Internal route in YII 

    Answer
    The format for a route is moduleID/controllerID/actionID. For example, the actionPage method of WebsiteController corresponds to the website/page route.    Page: 43

    1. Report
  2. Question:What’s the difference between renderPartial and render method when outputting view? 

    Answer
    CController::renderPartial does the same template processing as CController::render, except the former does not use layout. As we can access the current controller in a view using $this, we can use its renderPartialto use a view within another view.   Page: 68

    1. Report
  3. Question:Discuss the function of clips in YII. How to use clip? 

    Answer
    One of the Yii features you can use in your views is clips. The basic idea is that you can record some output and then reuse it later in a view.               
    Example: 
    <?php $this->beginClip('footer')?>
    This application was built with Yii.
    <?php $this->endClip()?>
    Page: 68-69

    1. Report
  4. Question:What is decorator in YII? 

    Answer
    we can enclose content into a decorator. The common usage of decorators is 
    Layout. Yes, when you are rendering a view using the render method of your controller, 
    Yii automatically decorates it with the main layout.    Page: 70

    1. Report
  5. Question:What are the advantages of managing assets in YII? 

    Answer
    An ability to manage assets is one of the greatest parts of Yii. It is especially useful in the following cases:
    1.	 When you want to implement an extension that stores its JavaScript, CSS, and images in its own folder that is not accessible from a browser.
    2.	When you need to pre-process your assets: combine JavaScript, compress it, and so on.
    3.	When you use assets multiple times per page and want to avoid duplicates.

    1. Report
  6. Question:How and where can you add a client side script in YII? 

    Answer
    The index view is rendered by the index action and is used to initialize the application and provide a do Template that is used for rendering on the client side. We can use it by following way : 
    Yii::app()->clientScript->registerPackage('todo');

    1. Report
  7. Question:How can you add css file in YII? 

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

    1. Report
  8. Question:How to access application configuration parameters in YII? 

    Answer
    application configuration parameters that can be accessed using 
    Yii::app()->params['paramName']
    'params'=>array(
    // this is used in contact page'adminEmail'=>'webmaster@example.com',
    ),

    1. Report
  9. Question:In order to upload file, which html form attributes you have to take. 

    Answer
    We have to use the following html  form attributes : 'htmlOptions'=>array('enctype'=>'multipart/form-data')

    1. Report
  10. Question:Discuss the advantages of using gii in YII. 

    Answer
    Efficient coding with Yii implies efficient use of the gii code generator. It helps to create model,view and controller without writing codes.

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