connet.lolipop.jp
Bladeテンプレートを作る
ここからは、larabel特有のページを作成します。
作成したページは、以下のディレクトリへ保存します。
resources/views/


1.マスターページのレイアウト
共通表示のベースとなるページです。

common.blade.php
              <!DOCTYPE HTML>
              <html lang="ja">
              <head>    
               @yield('head')
              </head>
              <body>   
               @yield('header')
               <div>                      
                @yield('content_head')
                @yield('content')
               </div>             
               @yield('footer')
               @yield('recdel_js')
              </body>
              </html>
2.ヘッドページのレイアウト
headには、ページの基本情報を記述します。

head.blade.php
				      @section('head')
				      <meta charset="utf-8">
				      <title>Laravel 5.4 SampleDB</title>
				      <meta name="Keywords" content="Laravel,PHP,HTML,CSS">
				      <meta name="Description" content="Laravel 5.4でデータベースを作る">
				      
				      <style type="text/css">
				      	h1,h2,h3,hr {
				      	margin:0;
				      	padding:0;
				      	}    
				      	body {
				      	width:900px;
				      	padding:10px;
				      	color:#440000;
				      	}
				      	a {
				      	color:#440000;
				      	font-weight:bold; 
				      	text-decoration:underline;
				      	}
				      	a:hover {
				      	color:#330000;
				      	text-decoration:none;        
				      	}
				      </style> 
				      @endsection
3.ヘッダーページのレイアウト
headerの表示。

header.blade.php
				      @section('header')   
				      <header>
				      <div style="width:310px;padding:5px;background:#c4e3f3;">
				      <h1>Laravel 5.4 SampleDB</h1>
				      </div>
				      </header>    
				      @endsection
4.フッターページのレイアウト
footerの表示。

footer.blade.php
				      @section('footer')
				      <footer>
				      <br /><div>Copyright © 2017 Web AgoraNet</div><br />
				      </footer>
				      @endsection
Search
Google


↟ このページの先頭へ