Commit 3c603a81 by Seldaek

+ adds two util methods to ZF view

git-svn-id: svn://dwoo.org/dwoo/trunk@150 0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent f738fcab
......@@ -263,4 +263,56 @@ class Dwoo_Adapters_ZendFramework_View extends Zend_View_Abstract
$this->_engine->setCharset($charset);
return $this;
}
/**
* Given a base path, add script, helper, and filter paths relative to it
*
* Assumes a directory structure of:
* <code>
* basePath/ (view scripts)
* helpers/
* filters/
* </code>
*
* @param string $path
* @param string $prefix Prefix to use for helper and filter paths
* @return Zend_View_Abstract
*/
public function addBasePath($path, $classPrefix = 'Zend_View')
{
$path = rtrim($path, '/');
$path = rtrim($path, '\\');
$path .= DIRECTORY_SEPARATOR;
$classPrefix = rtrim($classPrefix, '_') . '_';
$this->addScriptPath($path);
$this->addHelperPath($path . 'helpers', $classPrefix . 'Helper');
$this->addFilterPath($path . 'filters', $classPrefix . 'Filter');
return $this;
}
/**
* Given a base path, sets the script, helper, and filter paths relative to it
*
* Assumes a directory structure of:
* <code>
* basePath/ (view scripts)
* helpers/
* filters/
* </code>
*
* @param string $path
* @param string $prefix Prefix to use for helper and filter paths
* @return Zend_View_Abstract
*/
public function setBasePath($path, $classPrefix = 'Zend_View')
{
$path = rtrim($path, '/');
$path = rtrim($path, '\\');
$path .= DIRECTORY_SEPARATOR;
$classPrefix = rtrim($classPrefix, '_') . '_';
$this->setScriptPath($path);
$this->setHelperPath($path . 'helpers', $classPrefix . 'Helper');
$this->setFilterPath($path . 'filters', $classPrefix . 'Filter');
return $this;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment