당신은 거기에 몇 가지 추가 기능을 원한다면 당신은 항상 뷰 모델을 확장 할 수 ... 컨트롤러에 이제
class MyViewModel extends ViewModel
{
/**
* Default Variables to set
*/
protected $_defaultValues = array(
'test' => 'bob'
);
/**
* Constructor
*
* @param null|array|Traversable $variables
* @param array|Traversable $options
*/
public function __construct($variables = null, $options = null)
{
//$variables = array_merge($this->_defaultValues, $variables);
$this->setVariables($this->_defaultValues);
parent::__construct($variables, $options)
}
}
그냥 대신 새로운 뷰 모델을 돌려 사용
/**
* Some Controller Action
*/
function myAction()
{
return new MyViewModel();
}
을 당신은 아마 것 렌더링 메뉴와 같은 것들을 위해 ViewHelper를 사용하고 싶습니다. 여기를보십시오 : http://framework.zend.com/manual/2.0/en/modules/zend.view.helpers.advanced-usage.html. –