Reputation: 4253
Simple view not rendering:
public function getFranchise() {
echo 'getFranchise';
$franchiseData['shopViews'] = array(1 => 'a');
$franchiseData['aaa'] = 'bbb';
return View::make('test.filteredData.franchise', $franchiseData);
}
view in test/filteredData/franchise.blade.php
franchise
{{--$shopsViews}} {{-- Fatal error: Method Illuminate\View\View::__toString() must not throw an exception in D:\projektai\dashboard\app\storage\views\d2973247ea68aed2fdfd33dc19cccada on line 5}}
{{ $aaa }}
@foreach ($shopsViews as $shop)
<strong>aaa</strong>
@endforeach
Only word getFranchise is displayed which means controller function is called. No any errors, no anything. WHat is that?
Even in constructor is added
ini_set("display_errors", true);
Edited
Found that this:
{{--$shopsViews}} {{-- Fatal error: Method Illuminate\View\View::__toString() must not throw an exception in D:\projektai\dashboard\app\storage\views\d2973247ea68aed2fdfd33dc19cccada on line 5}}
comment was causing stop of execution in the script. WHy is that? this is valid laravel comment. Also I noticed weird thigs when I comment
<?php //print_r ?>
then it shows something like web page not found, like interent connection has gone. I dont get at all whats happening with commenting.
Upvotes: 0
Views: 1523
Reputation: 685
Your blade view must contain @extends() and @section() to work in this case. And comment should look like this {{-- $shopsViews --}}. That should fix your problem.
@extends('your_layout_folder.layout')
@section('content')
@foreach ($shopsViews as $shop)
<strong>aaa</strong>
@endforeach
@stop
Please follow the documentation! http://laravel.com/docs
Upvotes: 2