Frequently Asked Questions
Have a question? You might find it in our FAQ.
If you can't find an answer here, you can subscribe to the appropriate list and search the wiki. Keep in mind that a lot of Zend Framework content can be found on other sites; a Google search may also turn up your answer. If you come up with an answer that you believe others could benefit from, please contact us about adding it to the FAQ.
What is the difference between Zend_Auth and Zend_Acl?
Zend_Auth is used for authenticating users; authentication is the act of verifying that the provided credentials are valid - that somebody is who they say they are. For more information on Zend Framework's authentication implementation, visit the Zend_Auth documentation.
Zend_Acl provides an Access Control List (ACL) implementation. ACLs are used to authorize somebody to do something - typically to or with a given resource. Zend_Acl allows you to verify that a role has the rights to a particular resource. For more information on Zend_Acl, read the Zend_Acl documentation.
How can I contribute to Zend Framework?
There are lots of ways to contribute to Zend Framework. Many major features are contributed to ZF through our proposal process. Many code contributors also commit bug fixes and tests. Another valuable form of contribution is manual translation. Contributors may also invest their time in updating the wiki or adding, commenting on, and voting on issues in our issue tracker. No matter how you plan to contribute, the best place to get started is our contributor guide.
Actually, by default, if your expression includes parentheses, Zend_Db_Select will cast the statement appopriately. However, if it does not, or you are having problems, you can use Zend_Db_Expr to explicitly create the expression:
How can I customize the appearance of my forms using Zend_Form?
You're probably looking for decorators. All forms and form elements in Zend_Form use decorators to render their output.
How can I add extra HTML (such as a link) to my form element?
This can easily be done using decorators. For instance using the Description decorator. It is important to note though that you will need to turn off escaping for the output of the decorator:
Now, you can use the following to add extra HTML to the element:
Why do I get failures when I want to display a file element?
The file element needs a special file decorator. It is added per default by the file element. But when you set your own decorators you deleted the default ones. See this example:
But you have to use the file decorator instead of the ViewHelper for the file element. So you should use it like this:
Zend Framework was built to use all of the advanced object oriented features of PHP 5. Since PHP 4 is not fully forwards compatible with PHP 5, the Zend Framework community was faced with the decision of committing to support PHP 4 or leveraging existing and future enhancements in PHP 5 from the outset. We felt the overall value proposition was tipped in favor of PHP 5 feature, performance, and security enhancements. On top of that, PHP 4 is officially unsupported by the PHP community as of 2008-01-01, and no critical security updates will be published after 2008-08-08.
Where is the model in ZF's MVC implementation?
Unlike the view and the controller components, the model component can vary dramatically in responsibilities and data store from one MVC application to the next. The ZF community has not defined a model interface, class, or other formalism simply because we wanted to avoid introducing limitations without significant added value. With the introduction of Zend_Form in ZF 1.5, there is potential added value in form-model interoperability. We will evaluate proposals for models which facilitate this interoperability while supporting all data backends for future inclusion in the standard library.
Is ZF a component library or a framework?
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 easier to use just a few components to provide functionality to a web application- even alongside other frameworks! With 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 that will make it simpler to build applications using ZF components, yet will not sacrifice the use-at-will nature of existing ZF components. In fact, the tooling component itself can be used alone.
How can I make all i18n-aware components aware of my Zend_Translate object?
A variety of components are are translation aware (i.e., accept Zend_Translate objects), including:
- Zend_View_Helper_Translate
- Zend_Validate_*
- Zend_Form
To have them all use the same Zend_Translate instance, simply place it in the registry with the key "Zend_Translate":
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:
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.
Why are my dates formatted wrong? Why do I get the false year value?
When using own formats in your code you could come to a situation where you get for example 29.12.2009, but you expected to get 29.12.2008.
There is one year difference: 2009 instead of 2008. You should use the lower cased year constant. See this example:
Note the lower cased "y" which makes the difference and outputs the real year.
Unlike the view and the controller components, the model component can vary dramatically in responsibilities and data store from one MVC application to the next. The ZF community has not defined a model interface, class, or other formalism simply because we wanted to avoid introducing limitations without significant added value. With the introduction of Zend_Form in ZF 1.5, there is potential added value in form-model interoperability. We will evaluate proposals for models which facilitate this interoperability while supporting all data backends for future inclusion in the standard library.
How can I retrieve the view object within a plugin or arbitrary code?
By default, ZF uses an action helper called the ViewRenderer. This action helper instantiates and stores a Zend_View object which is injected into various other objects. To get the ViewRenderer, pull it from the Action Helper broker:
The view object is stored in the ViewRenderer's view property:
However, if you're grabbing the view early in the dispatch process- before an action is actually dispatched, for example- then you may need to initialize the view first:
The view can also be obtained via the layout object. If you are using and have already initialized Zend_Layout, you can get at the view object much more succinctly:
This actually proxies to the ViewRenderer, and does all of the above steps for you.
ContextSwitch makes the assumptions that (a) you are not calling _forward() and (b) that your application code will not throw an exception. If you see the above error, your code is throwing an exception - but the context is still in play, and the ViewRenderer is simply trying to load a view script for the current context from the ErrorController.
The easiest way to fix the situation is to have the ErrorController::errorAction() redefine the view script suffix, as follows:
Apache by default disallows urlencoded slashes (i.e., "%2F") in URL path parts or the query string. This feature can be disabled by enabling the "AllowEncodedSlashes" directive:
However, this directive must be set at either a server-wide (httpd.conf) or virtual-host level.
For more information, read the AllowEncodedSlashes documentation.
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.
Can I use Zend_Search_Lucene to search my Java Lucene-generated indexes? Can I use Java tools such as Luke to access and search my Zend_Search_Lucene-generated indexes?
Yes! We regularly use Luke to inspect our Zend_Search_Lucene-generated indexes, and the Zend Framework site itself accesses indexes created by our Java developer tools to provide site-wide search capabilities.
Zend Framework has been designed to solve the most common problems in web application development. Web services are a big part of today's web development environment. So much so that many of our users consume our web service clients for services such as Amazon ECS, Akismet, and ReCaptcha before adopting more infrastructure-oriented components such as Zend_Registry and Zend_Log. Because web services are so important in today's web applications, we have chosen to make them 'first-class citizens' in ZF.
There is an 'fw-all' list that aggregates all other lists besides fw-announce, fw-general, fw-docs, and fw-svn. Please try sending an email to fw-all-subscribe@lists.zend.com to make sure you're not subscribed to this list.
Also, please ensure that you mail all unsubscribe requests from the account that you subscribed with. You may be receiving list traffic on a different account if you have set up a mail forward from the original subscription account.
How do I get support, training, consulting, and/or certification for Zend Framework?
Zend Technologies provides a comprehensive set of services for Zend Framework, including:
- Support
- Training
- Consulting
- Certification (Coming Soon!)
Available Services
Licensing Information
Sign Up for News & Events
Things move quickly in the world of Zend Framework. By signing up on Zend's site, you can be sure that you're always on top of the latest Zend Framework news and events. You'll find valuable ZF resources on zend.com such as:
Zend's site also has lots of useful information on products such as Zend Platform, Zend Core, and Zend Studio that are full of features to make developing and deploying Zend Framework applications easier.
What are you waiting for? Sign up now!
