php - How do I render a view into a variable in ZF2? -


in class file, trying render .phtml file variable , pass html output of .phtml file variable in viewmodel. how do in zf2?

the code have far is, doesn't seem work:

$layout = new viewmodel(); $layout->settemplate('myphtmlfile.phtml'); $layout->setterminal(true);  $viewmodel = new viewmodel(); $viewmodel->setvariable('formbody', $layout); 

please see answer have provided in following thread:

this same:

  • you need phpviewrenderer
  • you save output of render() function variable
  • you pass variable view

however doing has pretty use-case that's described within other post. why want this? highly there's better solution you're trying accomplish.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -