So I'm getting a weird result that I can't wrap my head around. It's just a matter of how pretty the html look in the source, but it's a bit annoying as it also indent inconsistently sometimes.
Here is the layout.blade.php file, ignoring most of the html above the section:
</div>
<div class="content">
@yield('content')
</div>
</div>
</body>
</html>
Here is the index.blade.php that extends the layout.blade.php:
@extends('layout')
@section('content')
<div class="main-title">
<h1>Developer</h1>
<svg>
<line x1="0" y1="0" x2="300" y2="0" style="stroke:rgb(255,255,255);stroke-width:10" />
</svg>
<h1>Designer</h1>
</div>
@stop
I would assume this would be put at the same indent level as @yield() as that is what is happening in django template, and laravel tutorials.
This is what I am getting instead:
<div class="content">
<div class="main-title">
<h1>Developer</h1>
<svg>
<line x1="0" y1="0" x2="300" y2="0" style="stroke:rgb(255,255,255);stroke-width:10" />
</svg>
<h1>Designer</h1>
</div>
</div>
</div>
</body>
</html>
As you can see the content isn't places where the @yield() was placed in the layout.blade.php.
Looking at the generated php file that is being served It looks like it should be fine:
</div>
<div class="content">
<?php echo $__env->yieldContent('content'); ?>
</div>
</div>
</body>
</html>
Generated from index.blade.php:
<?php $__env->startSection('content'); ?>
<div class="main-title">
<h1>Developer</h1>
<svg>
<line x1="0" y1="0" x2="300" y2="0" style="stroke:rgb(255,255,255);stroke-width:10" />
</svg>
<h1>Designer</h1>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
Everything about this leads me the assume the served html would have propper tab spacing, but it doesen't. What can be the reason? Could there be some configuration or is it just a quirk of blade?
index.blade.html
orindex.blade.php
? – Dasindex.blade.php
is the correct file. – Andreas Halvorsen Tollånestidy_parse_string()
to clean it up. I would recommend not doing this on a production site though. php.net/manual/en/tidy.parsestring.php – user1669496