I'm using Zend_View
, I wrote a view helper, this view helper sets some variables.
One of my object uses Zend_View
to render some text, and, I want to set an option to my Object but inside the view using the view helper.
Let's say I've the following view script:
<?php
$this-&开发者_如何学JAVAgt;setRenderedDateTime(new Zend_Date());
<p>Foo bar</p>
My 'Object' do something like:
$object->getView()->render();
What I want is, before to render()
, I want to getRenderedDateTime();
Any ideas?
I've some ideas, but I'm wondering what the best way to implement such things.
From what I think you might need:
Make use of fluent interface. Make your view helper return itself for the main call. Look how view helper HeadScript is made :)
//in view
/** @return My_View_Helper_UberCool */
$helperInstance = $this->uberCool();
$helperInstance->setVariable($value);
Really not sure what it is you are asking, but have you looked into using Zend_Session for handling storing the RenderedDateTime?
If this is something that needs to be saved on a per-object basis, then I'm not sure why you need to be using Zend_View to store that objects state.
精彩评论