Prepare Interview

Exams Attended

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Zend Framework Interview Questions and Answers

Intermediate / 1 to 5 years experienced level questions & answers

Ques 1. Difference between Zend_Registry and Zend_Session?

The basic difference between these objects is the ‘scope’ in which they are valid:

a) Zend_Registry : request scope
b) Zend_Session : session scope

a) Zend_Registry is used to store objects/values for the current request. In short, anything that you commit to Registry in index.php can be accessed from other controllers/actions (because EVERY request is first routed to the index.php bootstrapper via the .htaccess file). Config parameters and db parameters are generally prepped for global use using the Zend_Registry object.

b) Zend_Session actually uses PHP sessions. Data stored using Zend_Session can be accessed in different/all pages. So, if you want to create a variable named ‘UserRole’ in the /auth/login script and want it to be accessible in /auth/redirect, you would use Zend_Session.

Is it helpful? Add Comment View Comments
 

Ques 2. When do we need to disable layout?

At the time of calling AJAX to fetch we need to disable layout.
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);

Is it helpful? Add Comment View Comments
 

Ques 3. Where is the model in ZF’s MVC implementation?

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

Is it helpful? Add Comment View Comments
 

Ques 4. How to call two different views from same action?

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’));

Is it helpful? Add Comment View Comments
 

Ques 5. How to include css from controller and view in zend.

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();?>

Is it helpful? Add Comment View Comments
 

Ques 6. How do you protect your site from sql injection in zend when using select query?

You have to quote the strings,
$this->getAdapter ()->quote ( );
$select->where ( ” = “, );
OR (If you are using the question mark after equal to sign)
$select->where ( ” = ? “, );

Is it helpful? Add Comment View Comments
 

Ques 7. Features of MVC in Zend Framework?

=> Declare custom routing rules
Not limited to “controller/action/param” format
=> Optional Controller Plugins, Action Helpers, and View Helpers
ErrorHandler plugin handles exceptions, 404 errors, etc.
FlashMessenger, Redirector, ViewRenderer helpers
Output common HTML elements in views
=> Extensible interfaces
Write your own plugins and helpers

Is it helpful? Add Comment View Comments
 

Ques 8. Why can't Zend_Form render my File element without errors?

The file element needs a special file decorator, which is added by default. When you set your own decorators for file elements, you delete the default decorators.
For example:
$element->setDecorators(array(
array('ViewHelper'),
array('Errors')
));
You should use a File decorator instead of the ViewHelper for the file element, like so:
$element->setDecorators(array(
array('File'),
array('Errors')
));

Is it helpful? Add Comment View Comments
 

Ques 9. How can I customize the appearance of forms generated by Zend_Form?

You're probably looking for decorators. All forms and form elements in Zend_Form use decorators to render their output.

Is it helpful? Add Comment View Comments
 

Ques 10. Why does the Zend Framework project have a CLA at all?

The CLA protects all users including individuals, small and medium businesses, and large corporations. By having a CLA in place, we mitigate the risk that companies who claim intellectual property infringement may demand royalties or fees from users of Zend Framework, whether individuals or companies. This is especially important for companies basing their business or products on Zend Framework. The Zend Framework CLA helps to ensure that code and other IP in Zend Framework remains free.

Is it helpful? Add Comment View Comments
 

Ques 11. Should I sign an individual CLA or a corporate CLA?

If you are contributing code as an individual- and not as part of your job at a company- you should sign the individual CLA. If you are contributing code as part of your responsibilities as an employee at a company, you should submit a corporate CLA with the names of all co-workers that you foresee contributing to the project.

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

Related interview subjects

Apache Kafka interview questions and answers - Total 38 questions
Language in C interview questions and answers - Total 80 questions
ANT interview questions and answers - Total 10 questions
Nature interview questions and answers - Total 20 questions
Ruby On Rails interview questions and answers - Total 74 questions
Business Analyst interview questions and answers - Total 40 questions
HTML interview questions and answers - Total 27 questions
Hadoop interview questions and answers - Total 40 questions
iOS interview questions and answers - Total 52 questions
HR Questions interview questions and answers - Total 49 questions
C++ interview questions and answers - Total 142 questions
Cryptography interview questions and answers - Total 40 questions
JSON interview questions and answers - Total 16 questions
CSS interview questions and answers - Total 74 questions
XML interview questions and answers - Total 25 questions
Ethical Hacking interview questions and answers - Total 40 questions
Android interview questions and answers - Total 14 questions
ChatGPT interview questions and answers - Total 20 questions
Data Structures interview questions and answers - Total 49 questions
Zend Framework interview questions and answers - Total 24 questions
Fashion Designer interview questions and answers - Total 20 questions
REST API interview questions and answers - Total 52 questions
Unix interview questions and answers - Total 105 questions
SDLC interview questions and answers - Total 75 questions
©2023 WithoutBook