Back

extends() problem


Hi!

I'm starting my adventure with Laravel, and unfortunately I encounered a problem.

My app template is:

<!DOCTYPE html>
<html>
<head>
    ...
    <title>Title @yield('subtitle')</title>
</head>

<body>
@include('assets.topnav')

@yield('header')

@yield('content')

@include('assets.footer')

</body>
</html>

And my register view is:

@extends('app')

@section('subtitle')
    register
@stop

@section('content')
    content
@stop

What is the problem? When I visit register page I see some elements, which shouldn't be there (e.g. header section). But the real problem is, on the top of page there is "@extends('app') caption. This is the screen.

Sorry for this, but I'm just starting with learning laravel :)

Thanks, guys

thomastkim replied 3 years ago

Did you name your files with a blade extension?

For example app.blade.php and register.blade.php

c00perpl replied 3 years ago

Yes. My main template is app.blade.php and register view is register.blade.php. Here's another screen. It can be useful: http://oi57.tinypic.com/4h89yc.jpg

thomastkim replied 3 years ago Solution

Hm...I would start by stripping things away and seeing what might be causing the problem. I copied and pasted what you posted, and it worked for me.

Try removing the assets temporarily and seeing if that makes it work. That way, you could isolate which part of the code is the culprit.

Also, regarding single-line sections like your subtitle, I would recommend doing something like this:

@section('subtitle', 'register')
c00perpl replied 3 years ago

Thanks. Little steps, debugging and there was my little mistake - a typo ;)


Sign in to participate in this thread!



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