Laravel 包含主刀片错误

Posted

技术标签:

【中文标题】Laravel 包含主刀片错误【英文标题】:Laravel include master blade error 【发布时间】:2018-04-08 23:38:21 【问题描述】:

这里是机构文件夹下的create.blade.php

@extends('app')

@section('content)
<div class="row">
    <div class="col-lg-12 col-xs-12 col-sm-12">
        <div class="portlet light ">
            <div class="portlet-title">
                <div class="caption">
                    <i class="icon-cursor font-dark hide"></i>
                    <span class="caption-subject font-dark bold uppercase">Kurum Ekle</span>
                </div>
            </div>
            <div class="portlet-body">
                <div class="row">
                    <div class="col-md-5">
                        <div class="form-group">
                            <label class="control-label"><strong>Kurum Adı : </strong></label>
                            <input type="text" name="institution_name" class="form-control" />
                        </div>
                        <hr />
                        <div class="portlet light bordered">
                            <div class="portlet-title tabbable-line">
                                <div class="caption">
                                    <span class="caption-subject font-dark bold">Temalar</span>
                                </div>
                                <ul class="nav nav-tabs">
                                    @php ($i = 0)
                                    @foreach($themes["data"] as $theme)
                                        <li @if($i == 0) class="active" @endif>
                                            <a href="#$theme["identifier"]-theme-tab" data-toggle="tab">$theme["themeName"]</a>
                                        </li>
                                        @php ($i++)
                                    @endforeach
                                </ul>
                            </div>
                            <div class="portlet-body">
                                <div class="tab-content">
                                    @php ($i = 0)
                                    @foreach($themes["data"] as $theme)
                                        <div class="tab-pane @if($i == 0) active @endif" id="$theme["identifier"]-theme-tab">
                                            <h4 class="text-center"><strong>$theme["themeName"]</strong></h4>
                                            <form class="hide"></form>
                                            <hr />
                                            <div class="row">
                                                <div class="col-md-4">
                                                    <select class="form-control">
                                                        <option value="">Menü Seçin...</option>
                                                        @foreach($menus["data"] as $menu)
                                                            <option value="$menu["identifier"]">$menu["menuName"]</option>
                                                        @endforeach
                                                    </select>
                                                </div>
                                                <div class="col-md-5">
                                                    <div class="input-group">
                                                        <select class="form-control">
                                                            <option value="">Konum Seçin...</option>
                                                            <option value="0">Header Bottom</option>
                                                            <option value="1">Header Top</option>
                                                        </select>
                                                        <span class="input-group-btn">
                                                            <button id="genpassword" class="btn btn-success" type="button">
                                                                <i class="fa fa-plus fa-fw"></i> Ekle
                                                            </button>
                                                        </span>
                                                    </div>
                                                </div>
                                                <div class="col-md-3">
                                                    <button class="btn btn-block green-jungle"><i class="fa fa-check fa-fw"></i> Tamamla</button>
                                                </div>
                                            </div>
                                        </div>
                                        @php ($i++)
                                    @endforeach
                                </div>
                            </div>
                        </div> <!-- THEMES -->
                        <div class="portlet light bordered">
                            <div class="portlet-title tabbable-line">
                                <div class="caption">
                                    <span class="caption-subject font-dark bold">Tablolar</span>
                                </div>
                                <ul class="nav nav-tabs">
                                    @php ($i = 0)
                                    @foreach($datatables["data"] as $datatable)
                                        <li @if($i == 0) class="active" @endif>
                                            <a href="#$datatable["identifier"]-datatable-tab" data-toggle="tab">$datatable["datatableName"]</a>
                                        </li>
                                        @php ($i++)
                                    @endforeach
                                </ul>
                            </div>
                            <div class="portlet-body">
                                <div class="tab-content">
                                    @php ($i = 0)
                                    @foreach($datatables["data"] as $datatable)
                                        <div class="tab-pane @if($i == 0) active @endif" id="$datatable["identifier"]-datatable-tab">
                                            <h4 class="text-center"><strong>$datatable["datatableName"]</strong></h4>
                                            <form class="hide"></form>
                                            <hr />
                                            <div class="row">
                                                <div class="col-md-4">
                                                    <select class="form-control field_types">
                                                        <option value="">Field Seçin...</option>
                                                        @foreach($datatable["fields"]["data"] as $field)
                                                            <option value="$field["identifier"]" data-input="$field["inputType"]">$field["fieldName"]</option>
                                                        @endforeach
                                                    </select>
                                                </div>
                                                <div class="col-md-5">
                                                    <div class="input-group">
                                                        <input type="text" class="form-control field_captions" placeholder="Field Caption" />
                                                        <span class="input-group-btn">
                                                            <button id="genpassword" class="btn btn-success" type="button">
                                                                <i class="fa fa-plus fa-fw"></i> Ekle
                                                            </button>
                                                        </span>
                                                    </div>
                                                </div>
                                                <div class="col-md-3">
                                                    <button class="btn btn-block green-jungle"><i class="fa fa-check fa-fw"></i> Tamamla</button>
                                                </div>
                                            </div>
                                        </div>
                                        @php ($i++)
                                    @endforeach
                                </div>
                            </div>
                        </div> <!-- TABLES -->
                    </div>
                    <div class="col-md-6 col-md-offset-1">
                        <div class="portlet light bordered">
                            <div class="portlet-title tabbable-line">
                                <div class="caption">
                                    <span class="caption-subject font-dark bold">Formlar</span>
                                </div>
                                <ul class="nav nav-tabs">
                                    @php ($i = 0)
                                    @foreach($forms["data"] as $form)
                                        <li @if($i == 0) class="active" @endif>
                                            <a href="#$form["identifier"]-form-tab" data-toggle="tab">$form["formCaption"]</a>
                                        </li>
                                        @php ($i++)
                                    @endforeach
                                </ul>
                            </div>
                            <div class="portlet-body">
                                <div class="tab-content">
                                    @php ($i = 0)
                                    @foreach($forms["data"] as $form)
                                        <div class="tab-pane @if($i == 0) active @endif" id="$form["identifier"]-form-tab">
                                            <h4 class="text-center"><strong>$form["formCaption"]</strong></h4>
                                            <form class="hide"></form>
                                            <hr />
                                            <div class="row">
                                                <div class="col-md-4">
                                                    <select class="form-control field_types">
                                                        <option value="">Field Seçin...</option>
                                                        @foreach($form["fields"]["data"] as $field)
                                                            <option value="$field["identifier"]" data-input="$field["inputType"]">$field["fieldName"]</option>
                                                        @endforeach
                                                    </select>
                                                </div>
                                                <div class="col-md-5">
                                                    <div class="input-group">
                                                        <input type="text" class="form-control field_captions" placeholder="Field Caption Belirleyin." />
                                                        <span class="input-group-btn">
                                                            <button onclick="$.forms.addField(this);" class="btn btn-success" type="button">
                                                                <i class="fa fa-plus fa-fw"></i> Ekle
                                                            </button>
                                                        </span>
                                                    </div>
                                                </div>
                                                <div class="col-md-3">
                                                    <button class="btn btn-block green-jungle"><i class="fa fa-check fa-fw"></i> Tamamla</button>
                                                </div>
                                            </div>
                                        </div>
                                        @php ($i++)
                                    @endforeach
                                </div>
                            </div>
                        </div> <!-- FORMS -->
                    </div>
                </div>
                <hr />
                <div class="row">
                    <div class="col-md-4">
                        <a href="/institution" class="btn grey-cascade btn-outline pull-left"><i class="fa fa-chevron-left"></i> Geri</a>
                    </div>
                    <div class="col-md-8">
                        <button class="btn  blue-steel pull-right" onclick="saveInstitution(this);"><i class="fa fa-check"></i> Kurumu Oluştur</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@stop

和 app.blade.php

<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<!-- BEGIN HEAD -->

<head>
    <meta charset="utf-8" />
    <title>Metronic Admin Theme #2 | Admin Dashboard 2</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1" name="viewport" />
    <meta content="Preview page of Metronic Admin Theme #2 for statistics, charts, recent events and reports" name="description" />
    <meta content="" name="author" />
    <!-- BEGIN GLOBAL MANDATORY STYLES -->
    <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css" />
    <link href="/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <link href="/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
    <link href="/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="/assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
    <!-- END GLOBAL MANDATORY STYLES -->    
<body class="page-header-fixed page-sidebar-closed-hide-logo page-container-bg-solid">
<!-- BEGIN HEADER -->
<div class="page-header navbar navbar-fixed-top">
</div>
<!-- END HEADER -->
<!-- BEGIN HEADER & CONTENT DIVIDER -->
<div class="clearfix"> </div>
<!-- END HEADER & CONTENT DIVIDER -->
<!-- BEGIN CONTAINER -->
<div class="page-container">
    <!-- BEGIN CONTENT -->
    <div class="page-content-wrapper">
        <!-- BEGIN CONTENT BODY -->
        <div class="page-content">
        @yield('content')
        </div>
        <!-- END CONTENT BODY -->
    </div>
    <!-- END CONTENT -->
</div>
<!-- END CONTAINER -->
<!--[if lt IE 9]>
<script src="/assets/global/plugins/respond.min.js"></script>
<script src="/assets/global/plugins/excanvas.min.js"></script>
<script src="/assets/global/plugins/ie8.fix.min.js"></script>
<![endif]-->
<!-- BEGIN CORE PLUGINS -->
<script src="/assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="/assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="/assets/global/plugins/js.cookie.min.js" type="text/javascript"></script>
<script src="/assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="/assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="/assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<script src="/assets/global/scripts/api.path.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN THEME GLOBAL SCRIPTS -->
<script src="/assets/global/scripts/app.min.js" type="text/javascript"></script>
<!-- END THEME GLOBAL SCRIPTS -->
</body>

</html>

错误是:

错误异常 (E_ERROR) 解析错误:语法错误,意外的 'app' (T_STRING),期待 ',' 或 ')' (查看:C:\wamp64\www\hello.moto\resources\views\institution\create.blade.php)


\wamp64\www\admin.easyband\storage\framework\views\13e06b79742ec4731f5b70bccb8233a9af68f27a.php
                                </div>
                            </div>
                        </div> <!-- FORMS -->
                    </div>
                </div>
                <hr />
                <div class="row">
                    <div class="col-md-4">
                        <a href="/institution" class="btn grey-cascade btn-outline pull-left"><i class="fa fa-chevron-left"></i> Geri</a>
                    </div>
                    <div class="col-md-8">
                        <button class="btn  blue-steel pull-right" onclick="saveInstitution(this);"><i class="fa fa-check"></i> Kurumu Oluştur</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
Arguments

“解析错误:语法错误,意外'app'(T_STRING),期待','或')'”异常消息:解析错误:语法错误,意外'app'(T_STRING),期待','或' )'


如果我删除部分内容,效果会很好。我不知道我的错误在哪里?你能帮我吗?

【问题讨论】:

这是一个语法错误,所以你可能有未关闭的 if 语句或其他循环,缺少引号或太多,括号未关闭...检查您是否正确关闭所有内容 【参考方案1】:

从 create.blade.php 更新前两行,你错过了内容部分调用中的单引号。

@extends('app')

@section('content')

【讨论】:

为什么要低调?【参考方案2】:

我注意到:'

使用这个:

@extends('app')

@section('content')
<div class="row">

【讨论】:

【参考方案3】:

您在created.blade.php 中的部分名称后忘记了'

@section('content')

【讨论】:

以上是关于Laravel 包含主刀片错误的主要内容,如果未能解决你的问题,请参考以下文章

laravel:如何包含刀片布局中的部分?

如何根据输入请求规则在 laravel 刀片中显示错误消息

laravel刀片视图中的变量未定义错误

@include 之后刀片未在刀片中显示内容 - Laravel 4.2

Laravel 刀片模板停止重新加载主布局

如何从 Laravel5 中的刀片模板传递扩展主模板中的变量?