我想给{j}和url直接调用content.blade.php
打电话!如果我打电话给ajax,我不想包含master.blade
,因为它有jquery和许多基本链接,它会导致重复文件!当我在浏览器中调用直接链接时,我需要包含master.blade
。但是当我在浏览器中调用直接url时,内容页面没有显示(eg.This is content)
,ajax调用没问题!我该如何解决这个问题?
说出测试动作,
public function test(Request $request) {
return view("content",[ajax,$request->ajax()]);
}
master.blade.php
<html>
<head>
<title>@yield('title')</title>
</head>
<body>
@section('sidebar')
This is the master sidebar.
@show
<div class="container">
@yield('content')
</div>
</body>
</html>
content.blade.php
@includeWhen(!$ajax,"master")
@section('content')
This is content
@endsection
答案 0 :(得分:0)
它没有显示,因为您正在调用@section('content')
,但您没有产生它的模板。
您可以制作另一个布局而不需要您不想要的所有脚本:
@yield('content')
然后在你的content.blade.php中,当master.blade.php
不是ajax时扩展ajax.blade.php
,或者当它是ajax时扩展@extends($ajax ? 'ajax' : 'master')
@section('content')
This is content
@endsection
:
Public Sub GetData(ByVal FileName As String)
Dim strEmployeeNumber As String
Dim strEmployeeName As String
Dim strLocation As String
Dim intHours As Integer
Dim myDataSet As DataSet = ReadXLFile(FileName)
Dim myFirstCell As String
Dim mMatch As Match
Dim r As Regex = New Regex("^[0-9]+-[A-Za-z]+")
Dim arrFirstCell() As String
For Each myDr As DataRow In myDataSet.Tables(0).Rows
myFirstCell = myDr.Item(myDataSet.Tables(0).Columns(0))
mMatch = r.Match(myFirstCell)
If mMatch.Success Then
arrFirstCell = Split(mMatch.Value, "-")
strEmployeeNumber = arrFirstCell(0)
strEmployeeName = arrFirstCell(1)
strLocation = myDr.Item(myDataSet.Tables(0).Columns(1))
intHours = CInt(myDr.Item(myDataSet.Tables(0).Columns(2)))
Console.WriteLine("Number: {0} Name: {1} Location: {2} Hours: {3}", strEmployeeNumber, strEmployeeName, strLocation, intHours)
End If
Next
End Sub