Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current  |   View Page History

Frequently Encountered Problems

A list of frequently encountered problems that occur from simple mistakes or by those who simply "forgot" about what the manual said...

Problem Answer
Why is it rendering a view when I never told it too?

Or: Why am I gettin a  "Zend_View_Exception" about a script not being found?
ViewRenderer was added in RC1 which renders views automatically, based on your controller/action name, have a look at Zend Framework's MVC Introduces the ViewRenderer and the the manual on action helpers
How do I disable ViewRenderer then?
Simply set the 'noViewRenderer' controller param which will disable it completely:

You can read the ViewRenderer section of the manual for more precise control, see ViewRenderer Manual
How do I use a common header and footer in my View templates?
At the moment, the Zend Framework 1.0.0 doesn't have an "officially blessed" solution, so there are multiple approaches being used:
  1. Front Controller plug-in: Controller and View Question
  2. Zend_Layout proposal: Zend_Layout (Xend Layout tutorial)
  3. Zend_View Enhanced proposal: Zend_View_Enhanced
  4. Extend ViewRenderer directly: Extending ViewRenderer
  5. If the above fail (or seem too complicated), you can render alternative view scripts from your views:
Why am I getting an exception with the message 'Invalid controller specified (error)' You haven't set up an ErrorController to catch errors. By default the framework has a front controller plugin that tries to send all exceptions to a special controller (ErrorController in the default module). There's a sample error controller, and more information on the plugin, in the manual
Why am I getting an exception about "error.phtml" was not found?
This has to deal partly with ViewRenderer rendering view automatically, but more importantly, it occurs because there was an error somewhere and you were redirected to the ErrorController, but error.phtml could not be rendered, generating another error.
I'm having problems loading files, getting a "No such file" error.

 You may have one of the following problems:
  • You didn't set up your include path right, make sure the library is included. Set it on top of your bootstrap, before any require_once or Zend_Loader::loadClass() statements.
  • You've specified the library ending in 'Zend' (make sure it's /path/to/your/library, not /path/to/your/library/Zend/)
  • You're trying to load a model in a "models" directory, without having it set in your include path, have a look at Spotsec's model loader
How do I create urls like this "/index/about" for Zend Framework?
Zend Framework has a url view helper and a url action helper to generate urls for you. You can read about them more in this blog article: Use the url helper please
Why doesn't the action "NoRoute" work anymore? (Pre-ZF RC1)
As of ZF RC1 we now use the ErrorHandler controller plugin to handle all errors within the dispatch sequence.
How do I integrate Smarty with Zend Framework?
While it may cause problems and is probably discouraged, there have been many requests on how to do this. Here is one integration article for post RC1 ZF versions: Smarty Integration
Why does rendering fail after integrating Smarty and Zend Framework and implementing common layout templates (in a different directory to view templates)?
Note that Smarty can only handle one template directory (a limitation of Smarty). One work around is to make your View check if the file exists in each of the script paths and then set the template directory appropriately. Note that you'll also need to use {$this->render('template.tpl')} rather than
Unknown macro: {include file='template.tpl'}

for this to work. Full info on issue and resolution to follow!

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.