Friday, 15 April 2011

php - How to display controller's data in Laravel - Blade template engine -



php - How to display controller's data in Laravel - Blade template engine -

i have controller:

public function show($id) { $restaurant = restaurant::find($id); homecoming view::make('restaurants.profile')->with('restaurant', $restaurant); }

in view, trying utilize restaurant variable this:

<li> <label>name</label> <div class="oneinfo"> <label>$restaurant->id</label> </div> </li>

but got world $restaurant->id printed on browser, should have got value of id, right?

what doing wrong please? how can solve it?

many thanks

you should utilize {{ , }} wrapper around server-side code. in pure php , other frameworks, markup <?php echo $restaurant->id ?>

this how server knows if needs execute php code.

<li> <label>name</label> <div class="oneinfo"> <label>{{ $restaurant->id }}</label> </div> </li>

php laravel laravel-4 blade

No comments:

Post a Comment