Line | |
---|
1 | // ------------------------ |
---|
2 | // Usage example : |
---|
3 | // ------------------------ |
---|
4 | // Note that you might need to manually include 'lib/Dwoo.php', |
---|
5 | // 'lib/Dwoo/Adapters/ZendFramework/View.php', |
---|
6 | // 'lib/Dwoo/Adapters/ZendFramework/Dwoo.php', and |
---|
7 | // 'lib/Dwoo/Adapters/ZendFramework/PluginProxy.php' for this to |
---|
8 | // work as expected, depending on your ZF setup |
---|
9 | // |
---|
10 | // If anyone writes a more advanced how-to please let me know |
---|
11 | // ------------------------ |
---|
12 | |
---|
13 | $view = new Dwoo_Adapters_ZendFramework_View(array( |
---|
14 | 'compileDir' => 'path/to/compile_dir' // set to null or remove this line to use defaults |
---|
15 | 'cacheDir' => 'path/to/cache_dir' // set to null or remove this line to use defaults |
---|
16 | )); |
---|
17 | |
---|
18 | // This allows you to use ZF's helpers as if they were Dwoo plugins (i.e. {doctype} will call the doctype helper) |
---|
19 | // This also allows you to use $this->variable to access view variables from within templates |
---|
20 | |
---|
21 | $view->setPluginProxy(new Dwoo_Adapters_ZendFramework_PluginProxy(new Zend_View())); |
---|
22 | |
---|
23 | |
---|
24 | // 1. example - used with the Zend Controller |
---|
25 | |
---|
26 | $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view); |
---|
27 | |
---|
28 | Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); |
---|
29 | |
---|
30 | |
---|
31 | // 2. example - used manually |
---|
32 | |
---|
33 | $view->assign('foo', 'bar'); |
---|
34 | $view->display('foobar.phtml'); |
---|
Note: See
TracBrowser
for help on using the repository browser.