Support the ongoing development of Laravel.io →
Architecture
Last updated 2 years ago.
0

You can't do this. You can't concat 3 views in 1.
You should have 1 view to rule'em all.

return View::make('master')  
    ->nest('header_admin_template', 'header');  
    ->nest('home_view', 'home');  
    ->nest('footer_admin_template', 'footer');  

with something like this in master.php view

<body>  
<?php echo $header_admin_template;  ?>  
<?php echo $home_view;  ?>  
<?php echo $footer_admin_template;  ?>  
</body>  
Last updated 2 years ago.
0

imchivaa said:

Ok, so you wanna load multiple view with nested views?

assumed your child view is in views -> child (folder) -> subview.php

View::make('view_main')->nest('child', 'child.subview');

the 1st 'child' is actually the folder the subview located and 'child.subview' => subview is the view itself which is subview.php

In your case, try this

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

Make sure both home_view & footer_admin_template is inside views -> child (folder).

the first nest parameter is the variable name

Last updated 2 years ago.
0

spescina said:

imchivaa said:

Ok, so you wanna load multiple view with nested views?

assumed your child view is in views -> child (folder) -> subview.php

View::make('view_main')->nest('child', 'child.subview');

the 1st 'child' is actually the folder the subview located and 'child.subview' => subview is the view itself which is subview.php

In your case, try this

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

Make sure both home_view & footer_admin_template is inside views -> child (folder).

the first nest parameter is the variable name

Yeah, sorry. I removed the answer as it might confuse others.

Ok, so you wanna load multiple view with nested views?

assumed your child view is in views -> child (folder) -> subview.php

View::make('view_main')->nest('child', 'child.subview');

the 1st 'child' is actually the variable you will echo in your view and 'child.subview' => subview is the view itself which is subview.php and the child before it is the folder name.

In your case, try this

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

Make sure both home_view & footer_admin_template is inside views -> child (folder).

Last updated 2 years ago.
0

spescina said:

You can't do this. You can't concat 3 views in 1.
You should have 1 view to rule'em all.

return View::make('master')  
   ->nest('header_admin_template', 'header');  
   ->nest('home_view', 'home');  
   ->nest('footer_admin_template', 'footer');  

Hi it gives me PHP Syntax error

Last updated 2 years ago.
0

spescina said:

imchivaa said:

Ok, so you wanna load multiple view with nested views?

assumed your child view is in views -> child (folder) -> subview.php

View::make('view_main')->nest('child', 'child.subview');

the 1st 'child' is actually the folder the subview located and 'child.subview' => subview is the view itself which is subview.php

In your case, try this

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

Make sure both home_view & footer_admin_template is inside views -> child (folder).

the first nest parameter is the variable name

What if my views are NOT in child folder?

Last updated 2 years ago.
0

If It's not in child folder simply use

return View::make('header',$data)->nest('child','main',$data)->nest('child','footer',$data);
$view = View::make('header',$data);
$view->nest('child', 'home',$data); 
$view->nest('child', 'footer');
return $view;

should also work.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.