user1543871
user1543871

Reputation: 355

Laravel blade templates

I'm having difficulty getting my head around laravels blade templates.

I have a master.blade and I have an index.blade, no problems there.

What I want to do is inside my index.blade I want to nest another view: modal.blade

    // modal.blade.php
     <!-- Modal -->
    <div id="message" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="myModalLabel">{{ $header }}</h3>
        </div>
        <div class="modal-body" style="min-height: 430px">
            {{ $modal_content }}
        </div>
        <div class="modal-footer">
            <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
            {{ Form::submit('Save', array('class' => 'btn btn-primary')) }}
        </div>
    </div>

And I want to dynamically generate content for my modal.blade depending on the value of some variable inside my index.blade. Have I completely got the wrong idea or can this be done? Could someone please point me in the right direction? Any help greatly appreciated.

Upvotes: 2

Views: 3535

Answers (2)

Skid Kadda
Skid Kadda

Reputation: 482

Try this:

@include(view.name);

Upvotes: 4

Antonio Carlos Ribeiro
Antonio Carlos Ribeiro

Reputation: 87719

Basically you will need to @include('your.modal'), but there are some answers that may clarify layouting even better to you here: Templating in Laravel.

Upvotes: 2

Related Questions