I'm learning Laravel 5.1, I ran into an error using @yield
. I can not pass the contents of another file to the file where I want to include it.
Next I have the content I want to insert into the default-home.blade.php
file inside the layouts folder:
@extends('layouts.default-home')
@section('content')
<section id="feature_two">
<div class="container">
<div class="row">
<!-- Feature Two Description -->
<div id="feature_2_description" class="col-md-5 feature_description triggerAnimation animated" data-animate="fadeInLeft">
<h2>Super easy to customize and well detailed for beginners</h2>
<p>Vestibulum at est vel felis adipiscing tincidunt. Proin quis diam ac lectus pretium mollis interdum sed erat. Phasellus eget
neque eu ipsum laoreet suscipit tincidunt suscipit purus rutrum
</p>
<p>Etiam euismod, ligula nec volutpat tempor, risus lerisque tincidunt purus libero. Fusce tincidunt ligula, nec sagittis turpis</p>
</div><!-- End Feature Two Description -->
<!-- Feature Two Image -->
<div id="feature_2_image" class="col-md-7 feature_image text-right triggerAnimation animated" data-animate="fadeInRight">
<img class="img-responsive" src="img/thumbs/feature_two_img.png" alt="feature_two_img">
</div>
</div><!-- End row -->
</div><!-- End container -->
</section>
@stop
This is file with @yield
inserted, @includes
are working:
<body class="notransition" ng-app>
@include('layouts.head-home')
@yield('content')
@include('layouts.footer-home')
<div id="status"></div>
</body>
In this case, the site I'm developing uses the links in the menu to jump to another part of the site below, in addition to that content does not display the console displays this error every time I scroll the page or click the link for scrolling:
Uncaught TypeError: Can not read property 'top' of undefined
File routes.php:
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('','Site\HomeController@home');
Route::get('/','Site\HomeController@home');
?>
Controller:
<?php
namespace App\Http\Controllers\Site;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class HomeController extends Controller {
public function home(){
return view('site/home'); //chamando a view home.blade.php
}
}