Commit 69f61f83 by seldaek

* Added $this->viewParam support to ZendFramework adapter through a…

* Added $this->viewParam support to ZendFramework adapter through a Dwoo_Adapters_ZendFramework_Dwoo class that extends Dwoo, you should use this if you called setEngine() on the ZF view * Fixed some whitespace issues git-svn-id: http://svn.dwoo.org/trunk@341 0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent aa5c9622
......@@ -7,6 +7,9 @@
+ Improved parsing of array() to support real php array syntax as well
as variables as array keys, thanks to acecream for the help
+ Improved parsing of named parameters that can now be quoted
* Added $this->viewParam support to ZendFramework adapter through a
Dwoo_Adapters_ZendFramework_Dwoo class that extends Dwoo, you should use
this if you called setEngine() on the ZF view
* Fixed parsing of quoted keywords in if statements, like 'not' was
parsed as ! because using {if not $foo} is valid, but it was impossible
to use them even as string.
......
<?php
/**
* Dwoo base class for ZendFramework
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from the
* use of this software.
*
* @author Jordi Boggiano <j.boggiano@seld.be>
* @author Marc Hodgins <mjh@hodginsmedia.com>
* @copyright Copyright (c) 2010, Jordi Boggiano
* @license http://dwoo.org/LICENSE Modified BSD License
* @link http://dwoo.org/
* @version 1.2.0
* @date 2010-02-28
* @package Dwoo
*/
class Dwoo_Adapters_ZendFramework_Dwoo extends Dwoo
{
/**
* Redirects all unknown properties to plugin proxy
* to support $this->viewVariable from within templates
*
* @param string $name Property name
* @return mixed
*/
public function __get($name)
{
if (isset($this->getPluginProxy()->view->$name)) {
return $this->getPluginProxy()->view->$name;
}
$trace = debug_backtrace();
trigger_error('Undefined property via __get(): ' . $name .
' in ' . $trace[0]['file'] .
' on line ' . $trace[0]['line'], E_USER_NOTICE);
return null;
}
}
\ No newline at end of file
......@@ -2,7 +2,8 @@
// Usage example :
// ------------------------
// Note that you might need to manually include 'lib/Dwoo.php',
// 'lib/Dwoo/Adapters/ZendFramework/View.php' and
// 'lib/Dwoo/Adapters/ZendFramework/View.php',
// 'lib/Dwoo/Adapters/ZendFramework/Dwoo.php', and
// 'lib/Dwoo/Adapters/ZendFramework/PluginProxy.php' for this to
// work as expected, depending on your ZF setup
//
......@@ -15,6 +16,7 @@ $view = new Dwoo_Adapters_ZendFramework_View(array(
));
// This allows you to use ZF's helpers as if they were Dwoo plugins (i.e. {doctype} will call the doctype helper)
// This also allows you to use $this->variable to access view variables from within templates
$view->setPluginProxy(new Dwoo_Adapters_ZendFramework_PluginProxy(new Zend_View()));
......
......@@ -92,17 +92,6 @@ class Dwoo_Adapters_ZendFramework_View extends Zend_View_Abstract
*/
public function setOptions(array $opt = array())
{
// BC checks
// TODO remove in 1.1
if (isset($opt['compileDir']) || isset($opt['compile_dir'])) {
trigger_error('Dwoo ZF Adapter: the compile dir should be set in the $options[\'engine\'][\'compileDir\'] value the adapter settings', E_USER_WARNING);
}
if (isset($opt['cacheDir']) || isset($opt['cache_dir'])) {
trigger_error('Dwoo ZF Adapter: the cache dir should be set in the $options[\'engine\'][\'cacheDir\'] value the adapter settings', E_USER_WARNING);
}
// end BC
// Making sure that everything is loaded.
$classes = array('engine', 'dataProvider', 'compiler');
......@@ -273,7 +262,7 @@ class Dwoo_Adapters_ZendFramework_View extends Zend_View_Abstract
public function getEngine()
{
if (null === $this->_engine) {
$this->_engine = new Dwoo();
$this->_engine = new Dwoo_Adapters_ZendFramework_Dwoo();
}
return $this->_engine;
......
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