Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vincej's avatar
Level 15

Really Need Advanced Blade Templating Lesson

The laravel Docs are very poor in this area. I am wanting to create pages made up 4++ interchangeable layers so that I do not have to repeat a whole bunch of HTML.

The docs only tell you how to do the simplest of pages, as does the existing Laracasts videos.

I would really like to see a full and detailed explanation of the differences between show, include, stop, yield, section etc etc

quite frustrating ..

0 likes
14 replies
JeffreyWay's avatar

I'll try to do that this week. It's been on my list for a while. Maybe Thursday or Friday.

11 likes
vincej's avatar
Level 15

Just figured something out about Blade - layers work upside down, from the bottom up not the top down ...

Really looking froward to that advanced Blade lesson

thanks !

vincej's avatar
Level 15

@ludo237

I am putting together pages which have 3-4 layers to them, a little bit like layers in photoshop.

When I wrote that post, I was under the belief that L4 renders these layers bottom up, not top down. Now I am not too sure.

Mattiman's avatar

If you talk about many layers, do you mean something like this, where I nested 3/4 layers:

// /templates/items/create.blade.php

{!! Form::open(array('route' => 'app.items.create', 'class' => 'form')) !!}

    @include('partials.forms.item')

    <div class="form-group">
        {!! Form::submit('Create item', array('class'=>'btn btn-primary')) !!}
    </div>

{!! Form::close() !!}


// /templates/partials/forms/item.blade.php

    <div class="form-group">
        {!! Form::label('date', 'Item date', ['class' => 'control-label']) !!}
        {!! Form::text('date', null, array( 'class'=>'form-control', 'placeholder'=>'yyyy-mm-dd')) !!}
    </div>
    // more fields..

    @include('partials.forms.subitem')


// /templates/partials/forms/subitem.blade.php

    <div class="form-group">
        {!! Form::label('Subitem name') !!}
        {!! Form::text('subitemname', null, array( 'class'=>'form-control' )) !!}
    </div>
        // more fields..

    @include('partials.forms.subsubitem')


// /templates/partials/forms/subsubitem.blade.php

    <div class="form-group">
        {!! Form::label('Subsubitem name') !!}
        {!! Form::text('subsubitemname', null, array( 'class'=>'form-control' )) !!}
    </div>

Continuum's avatar

Disclaimer -- I'm quite a n00b -- I came to start a new project and realised how little I knew about iterating through multi-dimensional arrays to build an indented recursive parent-child menu. Working with blade and partials, and helper functions to output very bootstrap'ish HTML has gotten my code so messy so fast -- I don't mean to hijack Vinces' thread, but if an advanced Blade video worked in something that could be real-world useful, like a recursive menu structure, I know I, for one certainly benefit a great deal.

vincej's avatar
Level 15

@jeffreyway

Heah Jeffrey, Are you getting closer to producing this lesson ?

I'm also interested in the best way to loop over multi dimensional array and present the variables in a table.

akael's avatar

@vincej

Checkout this video: https://laracasts.com/series/laravel-5-fundamentals/episodes/13

It is geared towards L5 and gives you some of the things that changed in version 5.

You may also want to watch these: https://laracasts.com/series/laravel-5-fundamentals/episodes/5 https://laracasts.com/series/laravel-from-scratch/episodes/6 https://laracasts.com/series/laravel-from-scratch/episodes/7

Otherwise if there are any specific issues you are having post here and I will try and put together a sample to help you out on Friday (tomorrow/today since it is after midnight here!).

vincej's avatar
Level 15

Many Thanks @akael. I'll give them a look. @jeffreyway has been promising an advanced Blade lesson for a couple of weeks now.

Please or to participate in this conversation.