InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What Is The Difference Between "render" And "renderpartial" ? |
|
Answer» render() is commonly USED to render a view that corresponds to what a USER sees as a "page" in your application. It first renders the view you have specified and then renders the layout for the current controller action (if applicable), placing the result of the first render into the layout. It then performs output PROCESSING (which at this time means automatically inserting any necessary <script> tags and updating DYNAMIC content) and finally outputs the result. renderPartial() is commonly used to render a "piece" of a page/HTML. The main difference from render() is that this method does not place the results of the render in a layout. render() is commonly used to render a view that corresponds to what a user sees as a "page" in your application. It first renders the view you have specified and then renders the layout for the current controller action (if applicable), placing the result of the first render into the layout. It then performs output processing (which at this time means automatically inserting any necessary <script> tags and updating dynamic content) and finally outputs the result. renderPartial() is commonly used to render a "piece" of a page/HTML. The main difference from render() is that this method does not place the results of the render in a layout. |
|
| 2. |
How You Can Remove Index.php From Your Application Url ? |
|
Answer» Steps to remove index.php from your APPLICATION url. Step 1: First configure your Yii-application CONFIGURATION file like below code ..... Step 2: Enable apache rewrite ENGINE. To enable rewrite engine type the following command in your TERMINAL (Ubuntu ). a2enmod rewrite // to enable rewrite engine Step 3: Then, if you'd like, you can use the following .htaccess file in your application folder where index.php exists RewriteEngine On Thats all the 3 steps to remove index.php from the URL. Steps to remove index.php from your application url. Step 1: First configure your Yii-application configuration file like below code ..... Step 2: Enable apache rewrite engine. To enable rewrite engine type the following command in your terminal (Ubuntu ). a2enmod rewrite // to enable rewrite engine Step 3: Then, if you'd like, you can use the following .htaccess file in your application folder where index.php exists RewriteEngine On Thats all the 3 steps to remove index.php from the URL. |
|
| 3. |
What Is "gii" And Why It Is Used ? |
|
Answer» Gii is a module that provides Web-based code GENERATION capabilities. To work with gii, you need to change the main CONFIGURATION file of your application like FOLLOWING. return array( To access gii in your local system, hit the url on your BROWSER localhost/your-app/index.php?r=gii. You need to type the password that you have set in the main configuration of your app. to proceed further. Gii is a module that provides Web-based code generation capabilities. To work with gii, you need to change the main configuration file of your application like following. return array( To access gii in your local system, hit the url on your browser localhost/your-app/index.php?r=gii. You need to type the password that you have set in the main configuration of your app. to proceed further. |
|
| 4. |
How You Can Create And Work With Different Module In Yii ? |
|
Answer» To create a MODULE access gii URL and there you can create a module. after creating a module from gii you need to add it the MAI configuration FILE of your yii application. localhost/your-app/index.php?r=gii // utl to access gii .... To create a module access gii url and there you can create a module. after creating a module from gii you need to add it the mai configuration file of your yii application. localhost/your-app/index.php?r=gii // utl to access gii .... |
|
| 5. |
How To Configure Yii Aplication With Database ? |
|
Answer» In DEFAULT application of yii, open the main.php file exists in protected/config/main.php and search for a parameter named as db, there you can add host-name, database name , username and PASSWORD of your database server. In default application of yii, open the main.php file exists in protected/config/main.php and search for a parameter named as db, there you can add host-name, database name , username and password of your database server. |
|
| 6. |
How To Install Or Setup Yii-framework In Your Local System ? |
Answer»
To install Yii you need to |
|
| 7. |
How Can You Include A Javascript Menu Throught The Site? Give Steps? |
|
Answer» By adding the JAVASCRIPT files in webroot and call them in default VIEWS if NEEDED EVERYWHERE or just in the RELATED views. By adding the javascript files in webroot and call them in default views if needed everywhere or just in the related views. |
|
| 8. |
Can You List Some Database Related Functions In Yii? |
|
Answer» FIND, findAll , findByPk , find By ,QUERY find, findAll , findByPk , find By ,query |
|
| 9. |
If You Have To Validate A Registrations Module For A User, What All Can Be Possible Ways, Which One Is The Best? |
|
Answer» can be done on SUBMISSION in CONTROLLER, or USING javascript/ajax while user is still FILLING the data. Second option is BETTER. can be done on submission in controller, or using javascript/ajax while user is still filling the data. Second option is better. |
|
| 10. |
How Can We Use Ajax In Yii? |
|
Answer» by calling AJAX helper and then USING it in CONTROLLER for rendering. by calling ajax helper and then using it in controller for rendering. |
|
| 11. |
What Is The First Function That Gets Loaded From A Controller? |
|
Answer» index index |
|
| 12. |
How Do You Proceed When You Have To Use Yii For Any Application? |
|
Answer» take the framework either from Yii site or if you have changed according to your needs start from there. Proceed with basic software engg. concepts as requirement gathering etc.. This is a basic Understanding Concept in yii
take the framework either from Yii site or if you have changed according to your needs start from there. Proceed with basic software engg. concepts as requirement gathering etc.. This is a basic Understanding Concept in yii |
|
| 13. |
What Is The Component,helper And Why Are They Used,is There Other Way We Can Do Same Thing,what Is Better? |
|
Answer» A component is an INDEPENDENT piece of code WRITTEN for specific TASK that can be used by calling in controllers (example : email component), helper is used for HELPING yii in rendering the data to be shown to user with views, these only adds to MODULARITY in code otherwise same coding can be implemented in controllers. A component is an independent piece of code written for specific task that can be used by calling in controllers (example : email component), helper is used for helping yii in rendering the data to be shown to user with views, these only adds to modularity in code otherwise same coding can be implemented in controllers. |
|
| 14. |
What Is The Naming Convention Inyii? |
|
Answer» You can DEFINE table prefix when using Gii. In your case you need to set it to tbl_. Then it should generate UserController INSTEAD of TblUserController. The Yii Framework employs a class naming convention whereby the names of the classes directly map to the directories in which they are stored. The root level directory of the Yii Framework is the “framework/” directory, under which all classes are stored hierarchically. Class names may only contain ALPHANUMERIC CHARACTERS. Numbers are permitted in class names but are DISCOURAGED. Dot (.) is only permitted in place of the path separator. You can define table prefix when using Gii. In your case you need to set it to tbl_. Then it should generate UserController instead of TblUserController. The Yii Framework employs a class naming convention whereby the names of the classes directly map to the directories in which they are stored. The root level directory of the Yii Framework is the “framework/” directory, under which all classes are stored hierarchically. Class names may only contain alphanumeric characters. Numbers are permitted in class names but are discouraged. Dot (.) is only permitted in place of the path separator. |
|
| 15. |
What Is Model,view,controller? |
|
Answer» Models represent the underlying data structure of a Web application. Models are often shared among different sub-applications of a Web application. For example, a LoginForm model MAY be used by both the front end and the back end of an application; a News model may be used by the console commands, Web APIs, and the front/back end of an application. Therefore, models
Views are responsible for presenting models in the format that end users desire. In general, views
Controllers are the glue that binds models, views and other components together into a RUNNABLE application. Controllers are responsible for dealing directly with end user requests. Therefore, controllers
Models represent the underlying data structure of a Web application. Models are often shared among different sub-applications of a Web application. For example, a LoginForm model may be used by both the front end and the back end of an application; a News model may be used by the console commands, Web APIs, and the front/back end of an application. Therefore, models Views are responsible for presenting models in the format that end users desire. In general, views Controllers are the glue that binds models, views and other components together into a runnable application. Controllers are responsible for dealing directly with end user requests. Therefore, controllers |
|
| 16. |
What Is The First File That Gets Loaded When You Run A Application Using Yii? |
|
Answer» index.php index.php |
|
| 17. |
Can You Remember What Is Directory Structure When You Downloaded Yii? |
|
Answer» BACKEND/ backend/ |
|
| 18. |
What Yii Is So Fast? |
|
Answer» Yii is so much faster because it is using the lazy loading technique extensively. For example, it does not include a class file until the class is USED for the first time; and it does not create an object until the object is accessed for the first time. Other FRAMEWORKS suffer from the performance hit because they would enable a functionality (e.g. DB CONNECTION, user SESSION) no MATTER it is used or not during a request. Yii is so much faster because it is using the lazy loading technique extensively. For example, it does not include a class file until the class is used for the first time; and it does not create an object until the object is accessed for the first time. Other frameworks suffer from the performance hit because they would enable a functionality (e.g. DB connection, user session) no matter it is used or not during a request. |
|