Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在laravel中添加带有动态js和css的布局?_Php_Laravel - Fatal编程技术网

Php 如何在laravel中添加带有动态js和css的布局?

Php 如何在laravel中添加带有动态js和css的布局?,php,laravel,Php,Laravel,最近我学习了laravel框架。我使用composer安装了Laravel 5,我需要知道如何包括一个固定的布局,在那里我可以放置gobal css和js链接。写入路由 Route::get('/', function() { return View::make('pages.home'); }); Route::get('about', function() { return View::make('pages.about'); }); Route::get('projects

最近我学习了laravel框架。我使用composer安装了Laravel 5,我需要知道如何包括一个固定的布局,在那里我可以放置gobal css和js链接。

写入路由

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>
<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>
<!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>
@extends('layouts.default')
@section('content')
    i am the home page
@stop
我在这里找到了完整的教程