Support the ongoing development of Laravel.io →
Views Blade

Hey guys!

I am trying to make a little card layout, and each of these little cards has a pretty similar html structure, enough so that I figured blade might be able to help me out here. They need a header, an icon, a body, and a footer each, and I figured I could do all this easily with just doing:

@extends('cardlayout')
    @section('header')
        Invites
    @stop
    @section('body')
        <a href="#">Click here to see the invites!</a>
    @stop
    @section('icon')
        pr_thumbsup
    @stop

However this interferes with the main part of the template I am using which has it's own body, header, footer, etc tags. Is there a better way I should be doing this? This currently is not working at all.

Last updated 2 years ago.
0

either you use variables inside the templates and i don't think this would help, or you make a new file for cardlayout let's call it MainCardLayout and inside it just put the main codes with referring for the sections inside, then you extend it inside your Cardlayout and inside the other templates/ so you just need to create a main Layout file so CardLayout could extend it and the others as well.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.