……
>>In order to return just the name/key pairs from your action, you can grab
the parent view model from the MvcEvent:
>>...
>>class IndexController extends ActionController
>>{
>> public function indexAction()
>> {
>> $e = $this->getEvent();
>> $viewModel = $e->getViewModel();
>> $viewModel->setVariables(array(
>> 'name1' => 'value1',
>> 'name2' => 'value2'
>> ));
>> }
>>}
Not sure where is the problem.I tried this function, but get an error like
this:
Fatal error: Maximum function nesting level of '100' reached, aborting! in
E:\xampp\htdocs\zf2\vendor\ZendFramework\library\Zend\Loader\PluginClassLoad
er.php on line 185
>>But keep in mind if you do it this way, the 'content' key probably won't
be there if your layout goes looking for it.
>>
>>-Matt P.
_____
If you reply to this email, your message will be added to the discussion
below:
http://zend-framework-community.634137.n4.nabble.com/ZF2-contextSwitch-to-js
on-tp4418147p4452594.html
To unsubscribe from ZF2 contextSwitch to json ?, click here
<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.j
tp?macro=unsubscribe_by_code&node=4418147&code=eHVldGluZ0BiYW9zaWdodC5jb218N
DQxODE0N3wxNDMxNjE1Njk4> .
<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.
jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.nam
l.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.
view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aem
ail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3A
email.naml> NAML
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/ZF2-contextSwitch-to-json-tp4418147p4453194.html
Sent from the Zend Framework mailing list archive at Nabble.com.