Question

I want to use a partial view with content from another partial view, something like this:

@include('view1', array('content' => @include('view2')))

Unfortunately the view2is rendered as expected but view1is not, and just outputs @includein plain text.

The 2 views are not related at all therefore I believe I cannot use @yield (as this will mean a view will have to extend another).

Was it helpful?

Solution

Assuming that the inclusion of both views aren't dynamic, when returning the master view (the one that contains the include), you can nest view2

return View::make('master')->nest('content', 'view2');

Then in the view

@include('view1', array('content' => $content))

That or you could just include view2 within view1, is there a specific reason that this needs to be in the master view?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top