Zend Interview Questions

July 21st, 2012 by laeeq | 3 comments

Zend Framework Interview Question Answers

Question: What is autoloader?

Ans: Autoloader is function that load all the object on start up.

Question: What is use of Zend front controller?

Ans: Routing and dispatching is managed in the front controller. It collects all the request from the server and handles it.

Question: What is the use of Bootstrap?

Ans: Apart from index if we want to do any extra configuration regarding database and other things that is done within bootstrap.

Question: What is Zend auth?

Ans: It is used to authenticate user, for example like admin, general etc.

Question: What Zend Acl?

Ans: Based on the zend authentication it allows the user to access certain actions.

Question: What is application.ini file in Zend Framework?

Ans: Configuration can be done in application.ini file in Zend framework. This file in the path application/configs/application.ini.

Question: Checking whether form posted or not in Zend framework?

Ans:    $request = $this->getRequest();
$_GET = $request->getParams();
$_POST = $request->getPost();

Question: Does Zend Framework support PHP 4?

Ans: No. Zend Framework was built to use all of the sophisticated object oriented features of PHP 5 and take advantage of significant performance and security enhancements.

Question: When do we need to disable layout?

Ans: At the time of calling AJAX to fetch we need to disable layout.

$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);

Question: Where is the model in ZF’s MVC implementation?

Ans: The model component can vary dramatically in responsibilities and data store from one MVC application to the next.

Question: Can we call a model in view?

Ans: Yes, you can call a model in view. Simple create the object and call the method.

Question: How to include css from controller and view in zend ?

Ans: From within a view file: $this->headLink()->appendStylesheet(‘filename.css’);

From within a controller: $this->view->headLink()->appendStylesheet(‘filename.css’);

And then somewhere in your layout you need to echo out your headLink object:

headLink();?>

Question: How can you get a module name in bootstrap file ?

Ans: $router = new Zend_Controller_Router_Rewrite();
$request = new Zend_Controller_Request_Http();
$router->route($request);

$moduleName = $request->getModuleName();

Question: Name some Important component in zend framework?

Ans:

Gives the request & reponse methods by using its sub-classes.

$request = new Zend_Controller_Request_Http()
$response = new Zend_Controller_Response_Http()

Uses of Zend_Date
Date related processing can be done using this component.

Uses of Zend_File_Transfer
it provides extensive support for file uploads and downloads.

Uses of Zend_Db
It is used to doing database related purpose in our appication.

Uses of Zend_Paginator
Doing the pagination in our application.

Uses of Zend_Auth
It is used to authenticate a user.

$auth = Zend_Auth::getInstance();
$results = $auth->authenticate($adapter);
if ($results->isValid()){
}

Zend_Session_Namespace
This is a simple proxy class to use API into the Zend_Session managed $_SESSION Superglobal.

Question: How to call two different views from same action?

Ans:

Example1:
Public function indexAction() {
If(condition)
$this->render(‘yourview.phtml’);
Else
Index.phtml;

Example2:
Public function indexAction() {
}
Now in your index.phtml you can have this statement to call other view
$this->action(‘action name’,’controller name’,’module name’,array(‘parameter name’=>’parameter value’));

 

You can subscribe to PHPZAG.COM posts by Email

 

Related Topics:

 

 

  1. November 11th, 2012 at 20:44 | #1

    I was extremely pleased to uncover this web site. I want to to thank you for your time for this particularly wonderful read!! I definitely loved every little bit of it and i also have you saved to fav to look at new stuff on your site.

  2. November 14th, 2012 at 03:03 | #2

    It’s difficult to find knowledgeable people on this subject, but you sound like you know what you’re talking about! Thanks

  3. January 8th, 2013 at 00:49 | #3

    Thanks for this great tutorial, very informative. I wrote some down to keep following these guidelines.

  1. No trackbacks yet.