Different default template loading even though i have set
Posted: Mon Sep 28, 2015 7:43 am
In my views folder i have layouts/main.blade.php and under store/index.blade.php i am using the layout file like so:
In my storeController , i am calling the store/index.blade.php file like so:
In my routing file, i have the following:
But still when i load my / , i get some other template rather than layouts/main.blade.php. Why is this happening ? can anybody explain ?
Why is layouts/main.blade.php not loading when i hit / in the browser ?
Code: Select all
@extends('layouts.main') // importing here.
@section('promo')
<section id="promo">
<div id="promo-details">
<h1>Today's Deals</h1>
<p>Checkout this section of<br/>
products at a discounted price.</p>
<a href="#" class="default-btn">Shop Now</a>
</div><!-- end promo-details -->
{{ HTML::image('img/promo.png' , 'Promotional Ad') }}
</section><!-- promo -->
@stop
@section('content')
<h2>New Products</h2>
<hr>
<div id="products">
@foreach($products as $product)
<div class="product">
<a href="store/view/{{ $product->id }}">
{{ HTML::image($product->image , $product->title , array('class'=>'feature' ,
'width'=>'240' , 'height'=>'127')) }}
</a>
<h3>
<a href="/store/view/{{ $product->id }}">
{{ $product->title }}
</a>
</h3>
<p>
{{ $product->description }}
</p>
<h5>Availability:
<span class="{{ Availability::displayClass($product->availability) }}">
{{ Availability::display($product->availability) }}
</span>
</h5>
<p>
<a href="#" class="cart-btn">
<span class="price">${{ $product->price }}</span>
{{ HTML::image('img/white-cart.gif' , 'Add to Cart') }}
ADD TO CART
</a>
</p>
</div>
@endforeach
</div> <!-- end products -->
@stop
Code: Select all
public function getIndex() {
return View::make('store.index')
->with('products' , Product::take(4)->orderBy('created_at' , 'DESC')->get());
}
Code: Select all
Route::get('/', array('uses' => 'StoreController@getIndex'));
Why is layouts/main.blade.php not loading when i hit / in the browser ?