0

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.

0

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

2 Comments

interesting. I read the docs, but I thought its not necessary to extend. I dont want to. But if thats the only solution, then I will have to consider. BTw comment you wrote the same I was writing, didn't you? I mean {{-- $shopsViews --}}
oh, I just noticed that there are needed dashes at the end. I thought its like in sql - only dashes at the beginning.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.