2012-12-24, 02:48 AM
So I am working on a custom blog to integrate with MyBB, using laravel. Today, I noticed a few huge mistakes in my code.
Here's the code:
viewpost.blade.php (actual view that has data):
common/index.blade.php (layout):
Clearly, the CSS inclusion and the Title tag are within <head> and </head>, but Chrome outputs:
Note the blank <head> tags, and also the blank space at the start of the body tag.
Can anyone spot the issue with my code?
Here's the code:
viewpost.blade.php (actual view that has data):
Quote:@layout('common.index')
@section('navbar')
<li class="active"><a href="http://localhost/ext/public/blog">Home</a></li>
<li><a href="http://gamervoid.com">Forums</a></li>
<li><a href="http://localhost/ext/public/thing">Thing</a></li>
@endsection
@section('data')
<div id="post_container">
@foreach ($posts as $p)
<div class="post_post_container">
<h2>{{HTML::link("/blog/view/$p->id", $p->title) }}</h2>
<small>Posted at {{ $p->created_at }}</small>
<p>{{ nl2br($p->body) }}</p>
</div>
</div>
@endforeach
@endsection
common/index.blade.php (layout):
Quote:<!DOCTYPE html>
<html>
<head>
<title>Test page</title>
{{ HTML::style('css/global.css') }}
</head>
<body>
<div id="container" class="container">
<div id="header">
<div id="logo"><a href="http://localhost/ext/public/"><img src="http://gamervoid.com/images/dark/ice/logo.png" alt="logo" /></a></div>
<div id="panel">PANEL</div>
</div>
<!-- ADD BOOTSTRAP NAV MENU HERE -->
<div class="navbar">
<div class="navbar-inner">
<ul class="nav">
@yield('navbar')
</ul>
</div>
</div>
@yield('data')
</div>
</body>
</html>
Clearly, the CSS inclusion and the Title tag are within <head> and </head>, but Chrome outputs:
Quote:<html><head></head><body>
<title>Test page</title>
<link href="http://localhost/ext/public/css/global.css" media="all" type="text/css" rel="stylesheet">
<div id="container" class="container">
<div id="header">
<div id="logo"><a href="http://localhost/ext/public/"><img src="http://gamervoid.com/images/dark/ice/logo.png" alt="logo"></a></div>
<div id="panel">PANEL</div>
</div>
<!-- ADD BOOTSTRAP NAV MENU HERE -->
<div class="navbar">
<div class="navbar-inner">
<ul class="nav">
<li>« Back</li>
<li>| Forums</li>
<li>Thing</li>
</ul>
</div>
</div>
<div id="post_container">
<div class="post_post_container">
<h2>Test post</h2>
<small>Posted at 2012-12-24 01:33:04 by JHTech100</small>
<p>This is the initial blog post. You should delete it.</p>
</div>
</div>
</div>
</body></html>
Note the blank <head> tags, and also the blank space at the start of the body tag.
Can anyone spot the issue with my code?