In Laravel 3, I used to do this.
<?php render('partials.header'); ?>
This was done in "PHP" views, without using Laravel's Blade templates.
What's the equivalent of this in version 4?
I tried
<?php @include('partials.header'); ?>
This doesn't work.
If I do
@include('partials.header')
I have to save my file as ".blade.php"
How do I include a "subview" without using the blade template?
I am not sure how many people have been using Laravel 4 in this post, since this post, but if you are looking to include partials or separate your view types you can do it with @includes
for example, if you want a partials folder for your header, footer, sidebar etc
create a directory for the partials under
Then create a partial
Then in your master template file add the line
That is all it takes.
** Bonus you can also pass data to a partial or include nested partials within a partial
I am still pretty new to Laravel, but I think the below is pretty ideal ...
See Laravel View Composers .. http://laravel.com/docs/responses#view-composers
/views/page.php
From within a view, just echo the other view:
You can use View's nest function
Use the third parameter to pass data to the template
on your views/default/header.blade.php
I know this is a bit of a late answer, but I figured since I didn't see this solution amongst the other answers it was ok.
If you want to include your header and footer on every page I would add them into the before and after filters. Just go to filters.php in your app folder
When doing it this way you don't need to add anything in the view files to include them.
You can nest your partials in views try this
Then access the nested view file from your template
{{ $anyname }}
this way you don't have to include files in your view and this should work for .php file also.