Support the ongoing development of Laravel.io →
Views
Last updated 1 month ago.
0
return View::make('header_admin_template', $data)->nest('home_view', $data2)->nest('footer_admin_template', $data3);
Last updated 1 month ago.
0

eriktisme said:

return View::make('header_admin_template', $data)->nest('home_view', $data2)->nest('footer_admin_template', $data3);

Hi. I get error:

ErrorException

array_merge(): Argument #2 is not an array


$data = "Hie";
return View::make('header_admin_template', $data)->nest('home_view', $data)->nest('footer_admin_template', $data);

Last updated 1 month ago.
0

2 - What is the first argument in nest()?

The first argument is the name of the variable that you can use within your main view.

For example to access the content of "footer_admin_template" within your main view you would do something like:

<?php echo $footer_admin_template; ?>

for more info on views, read the "Passing Data To Views" and "Passing A Sub-View To A View" sections of the doc at:

http://laravel.com/docs/responses

Last updated 1 month ago.
0

behnampmdg3 said:

eriktisme said:

return View::make('header_admin_template', $data)->nest('home_view', $data2)->nest('footer_admin_template', $data3);

Hi. I get error:

ErrorException

array_merge(): Argument #2 is not an array


$data = "Hie";
return View::make('header_admin_template', $data)->nest('home_view', $data)->nest('footer_admin_template', $data);

My bad it should be like this.

$view = View::make('view')->nest('child', 'child.view', $data);

For more information you can visit https://coderwall.com/p/2v7urq

Last updated 1 month ago.
0

Thanks guys I read this in the documentation but still don't get it:


$view = View::make('greeting')->nest('child', 'child.view', $data);

What is child and what is child.view? I tried this and it didnt work:

ErrorException

Argument 3 passed to Illuminate\View\View::nest() must be of the type array, string given, called in /Applications/XAMPP/xamppfiles/htdocs/atless_admin/app/controllers/home.php on line 11 and defined


$view = View::make('header_admin_template')->nest('child', 'home_view', $data)->nest('child', 'footer_admin_template', $data);

As I said none of my views are sub views. They are all the same level. Some header, some body and some footer. I simply want to load them as I go like this:


$view = View::make('header_admin_template');
$view->nest('home_view', 'home_view');
$view->nest('footer_admin_template', 'footer_admin_template');
return $view;


Thanks

Last updated 1 month ago.
0

behnampmdg3 said:

Thanks guys I read this in the documentation but still don't get it:


$view = View::make('greeting')->nest('child', 'child.view', $data);

What is child and what is child.view? I tried this and it didnt work:


$view = View::make('header_admin_template')->nest('child', 'home_view', $data)->nest('child', 'footer_admin_template', $data);

As I said none of my views are sub views. They are all the same level. Some header, some body and some footer. I simply want to load them as I go like this:


$view = View::make('header_admin_template');
$view->nest('home_view', 'home_view');
$view->nest('footer_admin_template', 'footer_admin_template');
return $view;


Thanks

@behnampmdg3,

Did you find the solution? If so, then please help me to understand the nesting Sub-view.

Thanks in advance.

Last updated 1 month ago.
0

Sign in to participate in this thread!

LoadForge

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.