Skip to main content

Zend Framework Interview Questions and Answers

Here we have listed some useful Zend Framework Interview Questions with Answers for you.

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 also check:

2 thoughts on “Zend Framework Interview Questions and Answers

Leave a Reply

Your email address will not be published. Required fields are marked *

Shares

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!