Laravel 4.1 folder Layouts not available in views folder

别说谁变了你拦得住时间么 提交于 2020-01-06 21:12:41

问题


Does Laravel 4.1 comes with a layouts folder inside views or should it be created manually?

I made one myself but now my templates aren't working.

FYI installed Laravel with composer.

I want implement the below code template, consist 2 files:

user.blade.php(placed in app/views/layouts/user.blade.php)

    <!doctype html>
    <html>
        @section('lib')
        <head>
        <meta charset="utf-8">
        <link href="//netdna.bootstrapcdn.com/twitter-bootstrap
     /2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
        <style>
            table form { margin-bottom: 0; }
            form ul { margin-left: 0; list-style: none; }
            .error { color: red; font-style: italic; }
            body { padding-top: 20px; }
        </style>
    </head>
    @stop
    <body>

        <div class="container">
            @if (Session::has('message'))
                <div class="flash alert">
                    <p>{{ Session::get('message') }}</p>
                </div>
            @endif

            @yield('main')
        </div>

    </body>

</html>

And I want implement it to index.blade.php(app/views/user/index.blade.php)

@extends('layouts.user')

@section('head')

@show


<h1>All Users</h1>

<p>{{ link_to_route('users.create', 'Add new user') }}</p>

@if ($users->count())
<table class="table table-striped table-bordered">
    <thead>
        <tr>
            <th>Username</th>
    <th>Password</th>
    <th>Email</th>
    <th>Phone</th>
    <th>Name</th>
        </tr>
    </thead>

    <tbody>
        @foreach ($users as $user)
            <tr>
                <td>{{ $user->username }}</td>
      <td>{{ $user->password }}</td>
      <td>{{ $user->email }}</td>
      <td>{{ $user->phone }}</td>
      <td>{{ $user->name }}</td>
                <td>{{ link_to_route('users.edit', 'Edit',
 array($user->id), array('class' => 'btn btn-info')) }}</td>
                <td>
      {{ Form::open(array('method' 
 => 'DELETE', 'route' => array('users.destroy', $user->id))) }}                       
                        {{ Form::submit('Delete', array('class'
 => 'btn btn-danger')) }}
                    {{ Form::close() }}
                </td>
            </tr>
        @endforeach

    </tbody>

</table>
@else
  There are no users
@endif
@show 

When I override it, it's not working. Which is the wrong line or flow?

来源:https://stackoverflow.com/questions/30656072/laravel-4-1-folder-layouts-not-available-in-views-folder

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!