MyBB

MyBB 2.0 Using Laravel and Blade

Submitted by AndresXZ09, , Thread ID: 5390

Thread Closed

RE: MyBB 2.0 Using Laravel and Blade

AndresXZ09
Closed Account
Level:
0
Reputation:
30
Posts:
1.22K
Likes:
139
Credits:
1.51K
OP
01-07-2015, 02:03 AM
This post was last modified: 01-07-2015, 02:05 AM by AndresXZ09
#11
It works something like this, you create a .blade.php file in your views folder (I usually use layouts, to be more organized)

Let's say that we're going to create the errorsmaster.blade.php file, then, we fill the content as a standard page, but with some Blade exceptions

Here is the code that I'm using in OxyBB

Code:
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>OxyBB - @yield('title')</title>
        <link href="//fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
        <style>
            html, body {
                height: 100%;
            }

            body {
                margin: 0;
                padding: 0;
                width: 100%;
                color: #B0BEC5;
                display: table;
                font-weight: 100;
                font-family: 'Lato';
            }

            .container {
                text-align: center;
                display: table-cell;
                vertical-align: middle;
            }

            .content {
                text-align: center;
                display: inline-block;
            }

            .description {
                font-size: 72px;
                margin-bottom: 40px;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <div class="content">
                <div class="description">@yield('description')</div>
            </div>
        </div>
    </body>
</html>

Now, as it's supposed to show on the HTTP errors (404,403, etc) you create a new blade file in views/errors/ with the name of the error, let's say it's 404.blade.php

And now, as you're going to use the code that you already wrote extending it, you just put the next code in your file

Code:
@extends('layouts.errorsmaster')

@section('title', '404 Error')

@section('description')
    Content not found, noob
@endsection

And your result is the page

[Image: p2hrEU2.png]

It's a vague description of the potential of blade, but it's awesome.

Users browsing this thread: 2 Guest(s)