_resource->getAttribute('forActionName')) { $this->_forActionName = $forActionName; $this->_filesystemName = $this->_convertActionNameToFilesystemName($forActionName) . '.phtml'; } elseif ($scriptName = $this->_resource->getAttribute('scriptName')) { $this->_scriptName = $scriptName; $this->_filesystemName = $scriptName . '.phtml'; } else { throw new Exception('Either a forActionName or scriptName is required.'); } parent::init(); return $this; } /** * getPersistentAttributes() * * @return unknown */ public function getPersistentAttributes() { $attributes = array(); if ($this->_forActionName) { $attributes['forActionName'] = $this->_forActionName; } if ($this->_scriptName) { $attributes['scriptName'] = $this->_scriptName; } return $attributes; } /** * getContents() * * @return string */ public function getContents() { $contents = ''; if ($this->_filesystemName == 'error.phtml') { // should also check that the above directory is forController=error $contents .= << Zend Framework Default Application

An error occurred

message ?>

exception)): ?>

Exception information:

Message: exception->getMessage() ?>

Stack trace:

exception->getTraceAsString() ?>
  

Request Parameters:

request->getParams(), true) ?>
  
EOS; } elseif ($this->_forActionName == 'index' && $this->_resource->getParentResource()->getAttribute('forControllerName') == 'Index') { $contents =<< a:link, a:visited { color: #0398CA; } span#zf-name { color: #91BE3F; } div#welcome { color: #FFFFFF; background-image: url(http://framework.zend.com/images/bkg_header.jpg); width: 600px; height: 400px; border: 2px solid #444444; overflow: hidden; text-align: center; } div#more-information { background-image: url(http://framework.zend.com/images/bkg_body-bottom.gif); height: 100%; }

Welcome to the Zend Framework!

This is your project's main page

EOS; } else { $contents = '

View script for controller ' . $this->_resource->getParentResource()->getAttribute('forControllerName') . '' . ' and script/action name ' . $this->_forActionName . '
'; } return $contents; } protected function _convertActionNameToFilesystemName($actionName) { $filter = new Zend_Filter(); $filter->addFilter(new Zend_Filter_Word_CamelCaseToDash()) ->addFilter(new Zend_Filter_StringToLower()); return $filter->filter($actionName); } }