What Is Autoloader?
Autoloader is function that load all the object on start up.
What Is Use of Zend Front Controller?
Routing and dispatching is managed in the front controller. It collects all the request from the server and handles it.
What Is the Use of Bootstrap?
Apart from index if we want to do any extra configuration regarding database and other things that is done within bootstrap.
Zend Interview Questions and Answers
Is Zf a Component Library or A Framework?
ZF is both. Zend Framework provides all the components required for most web applications in a single distribution. But Zend Framework components are also loosely coupled, making it easy to use just a few components in a web application- even alongside other frameworks! Using this use-at-will architecture, we are implementing features commonly found in more monolithic frameworks. In fact, we are currently working on a tooling component for the 1.8 release that will make it simpler to build applications using ZF components, yet will not sacrifice the use-at-will nature of existing ZF components. It’s a testament to the use-at-will architecture of Zend Framework that the tooling component itself can be used standalone.
Zend Auth?
It is used to authenticate user, for example like admin, general etc.
Zend Acl?
Based on the zend authentication it allows the user to access certain actions.
How Do You Set Module Name, Controller Name, And Action Name in Zend Framework?
$request->setModuleName(‘front’);
$request->setControllerName(‘address’);
$request->setActionName(‘addresslist’);
Configuration in Zend Framework, Application.ini File?
Configuration can be done in application.ini file in Zend framework. This file in the path application/ configs/application.ini.
Checking Whether Form Posted Or Not In Zend Framework?
$request = $this->getRequest();
$_GET = $request->getParams();
$_POST = $request->getPost();
Does Zend Framework Support Php 4?
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.
Fetch Last Inserted Id, Fetch All Record and Fetch a Single Record.
$this->_db->lastInsertId();
$this->_db->fetchAll($sql);
$this->_db->fetchRow($sql);
Difference Between Zend_registry And Zend_session?
The basic difference between these objects is the ‘scope’ in which they are valid:
Zend_Registry: request scope
Zend_Session: session scope
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 prepared for global use using the Zend_Registry object.
Zend_Sessionactually 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.
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);
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.
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’));
Can We Call a Model in View?
Yes, you can call a model in view. Simple create the object and call the method.
Which Version of Php Does Zend Framework Require?
Zend Framework requires PHP 5.2.4 and up. Some Zend Framework components may work with earlier versions of PHP, but these components are tested and supported only on 5.2.4 and up.
Where's the Model?
Unlike the view and the controller components, the model component can vary dramatically in responsibilities and data storage from one MVC application to the next. It should represent what your application does in the abstract. The Zend Framework community has not defined a model interface, class, or other formalism because we haven't identified enough added value to justify limitations on what constitutes a model.
How Do U Set Module Name, Controller Name, And Action Name In Zend Framework?
$request->setModuleName(‘front’);
$request->setControllerName(‘address’);
$request->setActionName(‘addresslist’);
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.
Can We Rename the Application Folder?
yes, you can rename the application folder.
Can We Move the Index.php File Outside the Public Folder?
yes, you can move index.php file outside the public folder.
How to Include Js From Controller and View in Zend?
From within a view file: $this->headScript()->appendFile(‘filename.js’);
From within a controller: $this->view->headScript()->appendFile(‘filename.js’);
And then somewhere in your layout you need to echo out your headScript object:
headScript();?>
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();?>
How Do You Protect Your Site from Sql Injection In Zend When Using Select Query?
You have to quote the strings,
$this->getAdapter ()->quote (<variable name  );
$select->where (”<field name>  = “,<variable name>  );
OR (If you are using the question mark after equal to sign)
$select->where (”<field name>  = ? “, <variable name>);
How Can You Get a Module Name in Bootstrap File?
$router = new Zend_Controller_Router_Rewrite();
$request = new Zend_Controller_Request_Http();
$router->route($request);
$moduleName = $request->getModuleName();
What Is a Framework?
In software development, a framework is a defined support structure in which another software project can be organized and developed.
·         An abstract design
·         Set of common functionality
·         Developed for a particular domain
Why Should We Use Framework?
Framework is a structured system
·         Source codes become more manageable
·         Easy to extend features
·         Rapid application development.
What Is Bootstrapping?
Many PHP applications funnel server requests into a single (or few) PHP source file that sets up the environment and configuration for the application, manages sessions and caching, and invokes the dispatcher for their MVC framework. They can do more, but their main job is to take care of the consistent needs of every page of a web application.
In our Blueprint for PHP Applications, we will have a core bootstrapper that receives all dynamic requests for an application and applies a template for application behavior that we can later extend. It will allow us to later customize the functionality for each unique application.
What Is Zend Engine?
Zend Engine is used internally by PHP as a compiler and run time engine. PHP Scripts are loaded into memory and compiled into Zend opcodes.
What Is Zend Engine in Php?
Zend engine is like a virtual machine and is an open source, and is known for its role in automating the web using PHP. Zend is named after its developers Zeev and Aandi. Its reliability, performance and extensibility has a significant role in increasing the PHP’s popularity. The Zend Engine II is the heart of PHP 5. It is an open source project and freely available under BSD style license.
What Is Routing and How It's Work?
Zend_Controller_Router_Rewrite is the standard framework router. Routing is the process of taking a URI endpoint (that part of the URI which comes after the base URL) and decomposing it into parameters to determine which module, controller, and action of that controller should receive the request. This values of the module, controller, action and other parameters are packaged into a Zend_Controller_Request_Http object which is then processed by Zend_Controller_Dispatcher_Standard. Routing occurs only once: when the request is initially received and before the first controller is dispatched.
Zend_Controller_Router_Rewrite is designed to allow for mod_rewrite-like functionality using pure PHP structures. It is very loosely based on Ruby on Rails routing and does not require any prior knowledge of webserver URL rewriting. It is designed to work with a single Apache mod_rewrite rule.
What Are Plugins in Zend Framework?
·         Triggered by front controller events
·         Events bookend each major process of the front controller
·         Allow automating actions that apply globally
Creating Plugins:
·         Extend Zend_Controller_Plugin_Abstract
·         Extend one or more of the event methods.
What Is Mvc?
Model-View-Controller development pattern.
MVC is a software approach that separates application logic from presentation.
Model: The “stuff” you are using in the application data, – web services, feeds.
View: The display returned to the user.
Controller: Manages the request environment, and determines what happens.
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.
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.
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.
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.
What Is Front Controller?
It used Front Controller pattern. Zend also use singleton pattern.
routeStartup:This function is called before Zend_Controller_Front calls on the router to evaluate the request.
routeShutdown:This function is called after the router finishes routing the request.
dispatchLoopStartup:This is called before Zend_Controller_Front enters its dispatch loop.
preDispatch:called before an action is dispatched by the dispatcher.
postDispatch: is called after an action is dispatched by the dispatcher.
About Zend Framework?
Extending the art & spirit of PHP, Zend Framework Is based on simplicity, object-oriented best practices, corporate Friendly licensing, and a rigorously tested agile codebase, Zend Framework Is Focused on building more secure, reliable, and modern Web 2.0 applications &web services, and consuming widely available APIs from leading vendors like Google, Amazon, Yahoo. Flickr as well as API providers and cataloguers like Strike iron and ProgrammableWeb.
What Do I Have to Do to Contribute to Zend Framework?
The only requirement for contributing to Zend Framework is submitting our either our Individual Contributors License Agreement ((LA) or our corporate CLA. Once you have signed the CL you can visit our contributors wiki to get started.
We strongly recommend you read and understand the terms of our New BSD License-style license, under which all parts of Zend Framework are licensed, all contributions inclusive.
What Version of Php Is Zend Framework 2 Based On?
Zend Framework 2 Is based on PHP 5.3. We expect to add support For PHP 5.4 once it starts to be adopted by the PHP community.
Does This Mean That Zend Framework 1 Is About to Be End-of-lifed?
Definitely not! We currently plan to fully support Zend Framework I until at least early 20 14, including maintenance and security updates.
What New Features Will I Find In Zend Framework 2?
Some highlights:
·         An entirely re-written event-driven MVC layer
·         Dependency injection support
·         A powerful module management system
·   An EventManager, for writing event-driven systems, as well as for creating cut points in your software for introducing cross-cutting concerns.
·   A new view layer, architected around analyzing the request and generating a suitable response, be it plain old HTML, or Atom feeds or JSON.
What Services Are Available from Zend Technologies For Zend Framework?
Zend Technologies provides a comprehensive set of services for Zend Framework, including:
·         Support
·         Training
·         Consulting
·         Certification
What Is Lucene?
Lucene is a high-performance, full-featured text search engine that utilizes an open, binary format for storing search indexes and a standardized query format for querying against the indexes. Lucene was originally written in java as part of the Apache project. Zend_Search_Lucene is a PHP implementation that provides full binary compatibility with Java Lucene.
How Can I Debug Zend_date In a Simple Way?
When you think that you are getting wrong output from Zend_Date then it’s often needed to see what Zend_Date really uses internally.
Well., a var_dump of Zend_Date is not really helpful,l but you could simply use getIso(). This format has all date inform actions
available:
$date- >getIso(); I/could return 2009-10-21 T!5:OO:O2O 1:00’
Note that using toString() and outputting only parts of a date does not show all needed information’s. There could be a wrong used timezone, or a DST change which is suppressed by toString() but shown with getIso().
How Can I Debug Zend_date In a Simple Way?
When you think that you are getting wrong output from Zend_Date then it’s often needed to see what Zend_Date really uses internally.
Well., a var_dump of Zend_Date is not really helpful,l but you could simply use getIso(). This format has all date inform actions
available:
$date- >getIso(); I/could return 2009-10-21 T!5:OO:O2O 1:00’
Note that using toString() and outputting only parts of a date does not show all needed information’s. There could be a wrong used timezone, or a DST change which is suppressed by toString() but shown with getIso().
How Can I Detect If An Optional File Has Been Uploaded?
The receive() method will return true for file elements that are not required. The reason is that you said “the file can be omitted, and that’s ok for me”. The receive() method will return false only in the event of a failure.
Still there are several ways to detect if a file has been uploaded or not:
·         Use isUploaded which returns a boolean
·       Use getFileName which returns null in this case (note that you must use the latest release for this behavior)
·   Use getFileInfo which will have an empty ‘file’ key and the flag ‘isUploaded’ set to false
How Can I Use the Same Locale Everywhere?
With ZF 1.7 an application wide locale is supported. You can do the following in your bootstrap file:
$locale = new Zend_Locale(’en’);
Zend_Registry::set(’Zend_Locale $locaIe;

From now on, all locale aware components will use your locale object stored in the registry as long as you don’t give another one manually.
Request to Download PDF

Post A Comment:

0 comments: