Thanks Matthew,
I’m going to use option 3, I thought of $view->globals() namespace in
reference to $_GLOBALS.
I thought about $view->globalVars() or $view->vars() too… Humm I’ll
think about it.
Do you think it is a functionality which could be included out of the
box in ZF ?
--
Laurent Melmoux
Conseil et Solutions Web | [EMAIL PROTECTED]
2mx - Annecy, France | http://www.2mx.fr/
Matthew Weier O'Phinney a écrit :
-- Laurent Melmoux <[EMAIL PROTECTED]> wrote
(on Friday, 01 August 2008, 06:54 PM +0200):
<snip -- narrative on problems of global view variables now that partials exist>
So should I do:
1) One placeholder + key
$this->placeholder('Mmx_View_Globals')->urlRoot
$this->placeholder('Mmx_View_Globals')->urlAssets
$this->placeholder('Mmx_View_Globals')->urlTheme
$this->placeholder('Mmx_View_Globals')->urlImages
2) A placeholder for each var
$this->placeholder('urlRoot')
$this->placeholder('urlAssets')
$this->placeholder('urlTheme')
$this->placeholder('urlImages')
3) A special helper which extends
Zend_View_Helper_Placeholder_Container_Standalone
$view->globals()->urlRoot
$view->globals()->urlAssets
$view->globals()->urlTheme;
$view->globals()->urlImages
I personally think this option (3) makes the most sense, although I
wouldn't call it 'globals' -- namespace it with something a little more
meaningful or specific to your project. But it makes the implementation
very clean and relatively simple to implement.
4) Keep using my current setup
5) Other suggestions?
What are your recommendations ?
I'm curious to know how others tackled this problem too.