Zend Framework - Filename Case Sensitivity
Just a note if you’ve recently upgraded from Zend Framework 1.0.0 RC3 or earlier to the newly released 1.0.0 milestone: the Controller Action Helper ViewRenderer now only looks for view scripts that have filenames which are all lowercase. This change probably won’t affect too many users, but in the application I’m developing, I have some controller actions which are camel-cased for easier reading. Accordingly, some of my view script filenames were camel-cased so that ViewRenderer could find them. For instance:
class ReportController extends MdgController {
public function chartXMLAction(){
require_once('charts.php');
require_once('reports.php');
$this->view->assign('chartData',
Reports::getPatientsBySiteChartData());
}
}
In RC3 and earlier, ViewRenderer would attempt to render views/scripts/report/chartXML.phtml. Now 1.0.0 attempts to render views/scripts/report/chartxml.phtml. When the framework can’t find this view script, an exception is thrown.
There are quite a few fixes for this issue:
- Lowercase all your view script filenames
- Explicitly set the view script to render using Zend_Controller_Action::render(’yourFileNameSansExtension’);
- Modify the Framework files, specifically lines 714-720 of Zend/library/Controller/Action/Helper/ViewRenderer.php by removing the strtolower() calls:
$replacements = array(
':moduleDir' => $moduleDir,
':module' => str_replace($this->_delimiters, '-', strtolower($module)),
':controller' => str_replace($this->_delimiters, '-', strtolower(str_replace($this->_pathDelimiters, '/', $controller))),
':action' => str_replace($this->_delimiters, '-', strtolower($action)),
':suffix' => $suffix
);
No comments Jump to comment form | comments rss | trackback uri
Say what?
About this entry
Categories
- App Design (8)
- Blogs (6)
- Business (4)
- Code Philosophy (2)
- Javascript (1)
- Open Source (5)
- PHP (15)
- Thoughts (2)
- Tools (10)
- Usability (3)
- Wordpress (2)
- Zend Framework (9)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>