I'm using Laravel and passing some variables to views to echo them out using the blade syntax like so:
@extends('masterLayout')
@section('content')
@foreach($products $product)
<p>{{ $product->name}}</p>
@endforeach @stop
@end
In the masterLayout.blade.php file is the layout for the page, with the <html><head>
and <body>
tags. Problem is, when these variables are being passed to the view and echo'd they're not being put within the page where they should be. All the echo'd out data is placed at the top of the page above the HTML tag as if I were echoing it out in the controller and not in the view. Is there a setting to change within Laravel or a different way to achieve this?
EDIT: Okay here's the entire code of the views. there's actually three, inventory, inventoryLayout, and masterLayout. I've commented out the return View::make() in the controller and it disappears so I'm definitely not echoing it anywhere other than in the view itself. The help is appreciated!
master.blade.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>AppName</title>
<link rel="stylesheet" href="../assets/css/frontend.css">
</head>
<body>
<header class="navbar navbar-inverse navbar-fixed-top bs-docs-nav" role="banner">
<nav id='top-nav'>
<div class="centered-wrapper">
<ul>
<li><?php echo link_to('/login',"Login");?></li>
<li><?php echo link_to('/admin',"Admin");?></li>
<li><?php echo link_to('/inventory',"Inventory");?></li>
<li><?php echo link_to('/dashboard',"Dashboard");?></li>
<li><?php echo link_to('/recipes',"Recipes");?></li>
<li><?php echo link_to('/shopping_list',"Shopping List");?></li>
</ul>
</div>
</nav>
</header>
<div id="container">
@yield('content')
</div><!-- end container -->
</body>
</html>
inventoryLayout.blade.php
@extends('layouts.master')
<h1>My Inventory</h1>
@yield('inventoryItems')
inventory.blade.php
@extends('inventoryLayout')
@section('inventoryItems')
@foreach($products as $product)
<p>{{{ $product->name }}}</p>
@endforeach
@stop
@stop
after the foreach and an@end
(which I don't think does anything in Blade). – alexrussell