symfony - symfony2 rendering parial views in the controller and passing it as argument to the main render -


I want to create a simple page in symfony2 with 2 tabs think of tab as a link in tab form When you click on the link, the second page loads (full page load) but I do not want to duplicate my main view so that I want to present the content of the tab partially.

Main jogging .... my main scene .... .... Links to the styles as tabs .... Tab Content .... Footer

Tab1.twig (this is my partial for tab 1) ... some content - some variables also need to be accessed

tab2.twig (this is my partial tab 2). .. some content - again some variables need to be accessed, but no symphony 1 (or any other framework) has the same as tab 1

I only tab 1 or tab 2 ( No action I present my tab content and keep it in logic as main view -> render ('main', array (..... 'tabContents' => $ this-> renderpartial (' Tab2 ', array (... parameter ...), .....);

The question is, how can I do in Symphony 2? Preferably not through triggering render (my controller Within a partial form of my partial rendering).

In your controller :

  class DemoController Controller {public function in the main action () {$ tab1 = $ this- & gt; Render ('AcmeDemoBundle: Demo: tab1_template.html. Walking', array ('arg1' => $ ARG1)); // do sth return $ this- & gt; Render ('AcmeDemoBundle: Demo: main.html.twig', array ('tab1' => gt; $ tab1- & gt; getContent)); }  

Please -> Focus on getContent () on $ tab1


Comments