2016-06-24 27 views

答えて

1

書き込みルート

Route::get('/', function() 
{ 
    return View::make('pages.home'); 
}); 
Route::get('about', function() 
{ 
    return View::make('pages.about'); 
}); 
Route::get('projects', function() 
{ 
    return View::make('pages.projects'); 
}); 
Route::get('contact', function() 
{ 
    return View::make('pages.contact'); 
}); 

あなたは

- app 
-- views 
--- layouts 
------- default.blade.php 
------- sidebar.blade.php 
--- pages 
------- home.blade.php 
------- about.blade.php 
------- projects.blade.php 
------- contact.blade.php 
--- includes 
------- head.blade.php 
------- header.blade.php 
------- footer.blade.php 
------- sidebar.blade.php 

がhead.blade.php

<meta charset="utf-8"> 
<meta name="description" content=""> 
<meta name="author" content="Scotch"> 
<title>Super Cool Layouts</title> 
<!-- load bootstrap from a cdn --> 
<link rel="stylesheet" href="<?php echo asset('css/style.css'); ?>"> 
<script type="text/javascript" src="<?php echo asset('js/main.js'); ?>"></script> 
に以下を含め、このフォルダ構造に従っていることを確認します

header.blade.phpにおける書き込みヘッダとfooderと最後に含めるにdefault.blade.phpに

<!doctype html> 
<html> 
<head> 
    @include('includes.head') 
</head> 
<body> 
<div class="container"> 

    <header class="row"> 
     @include('includes.header') 
    </header> 

    <div id="main" class="row"> 

      @yield('content') 

    </div> 

    <footer class="row"> 
     @include('includes.footer') 
    </footer> 

</div> 
</body> 
</html> 

をレイアウトを作成

<div class="navbar"> 
    <div class="navbar-inner"> 
     <a id="logo" href="/">Single Malt</a> 
     <ul class="nav"> 
      <li><a href="/">Home</a></li> 
      <li><a href="/about">About</a></li> 
      <li><a href="/projects">Projects</a></li> 
      <li><a href="/contact">Contact</a></li> 
     </ul> 
    </div> 
</div> 

をfooter.blade.phpレイアウトをhome.blade.phpで使用する

@extends('layouts.default') 
@section('content') 
    i am the home page 
@stop 

ここで完全なチュートリアルを見つけましたInclude js and css file in laravel using blade

関連する問題