Concatinating Views in Laravel
Ad
I'm studying Laravel, and I want to know how to concatinate multiple views together.
I've looked through the documentation on laravel.com and can't find the section that tells me how to concatinate views.
I've solved the problem like this (in my controller):
public function showPage() {
return View::make('header') . View::make('content') . View::make('footer');
}
But surely there is a better/correct way... I would appreciate any help.
Ad
Answer
Ad
You can load do something like this
public function showPage() {
return View::make('page');
}
And in your page.blade.php
:
@include('header')
@include('content')
@include('footer')
But actually it would be better to have this structure.
layout.blade.php
:
@include('header')
@yield('content')
@include('footer')
page.blade.php
:
@extends('layout')
@section('content')
HTML of content here...
@stop
Ad
source: stackoverflow.com
Related Questions
Ad
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad