Php Zend Framework 2父视图中的inherid变量
我有下面的代码,它返回一个带有子视图的视图。 如图所示,子视图重复变量$form和数组&字段,将变量传递到视图中 我如何从responseView继承到userProfileInformationView并查看这些变量,并且只将它们注入responseViewPhp Zend Framework 2父视图中的inherid变量,php,zend-framework2,zend-view,zend-framework-mvc,Php,Zend Framework2,Zend View,Zend Framework Mvc,我有下面的代码,它返回一个带有子视图的视图。 如图所示,子视图重复变量$form和数组&字段,将变量传递到视图中 我如何从responseView继承到userProfileInformationView并查看这些变量,并且只将它们注入responseView $responseView = new ViewModel(); $responseView->setVariables(array( 'form' => $form, 'f
$responseView = new ViewModel();
$responseView->setVariables(array(
'form' => $form,
'fields' => $fields,
'userType' => $userType,
));
$responseView->setTemplate('templates/logged_user_profile');
$responseView->setTerminal(true);
$userProfileInformationView = new ViewModel();
$userProfileInformationView->setTemplate('templates/logged_user_profile_information');
$userProfileInformationView->setVariables(array(
'form' => $form, //I don't want this
'fields' => $fields, //I don't want this
));
$responseView->addChild($userProfileInformationView, 'userProfileInformation');
return $responseView;
我只知道一种编码方法:
<?php
$responseView = new ViewModel();
$responseView->setVariables(array(
'form' => $form,
'fields' => $fields,
'userType' => $userType,
));
$responseView->setTemplate('templates/logged_user_profile');
$responseView->setTerminal(true);
$userProfileInformationView = new ViewModel();
$userProfileInformationView->setTemplate('templates/logged_user_profile_information');
$userProfileInformationView->setVariables($responseView->getVariables());
$responseView->addChild($userProfileInformationView, 'userProfileInformation');
return $responseView;
?>