A small tip is to pass the string as the 2nd argument in the section function, like so:
@section('title', 'Portal Home')
I think that's the error: Try:
@extends('_layouts.default')
@section('title', 'Portal Home')
@section('pageh2', 'Portal Home')
@section('topname')
{{ $user_name or 'Default' }}
Just Text
@stop
@section('main')
Portal Home
@stop
Hope that helps...
I tried your tip but had no luck. When it comes to my title section where I am passing it as a second variable works fine. My issue just resides in the topname
section where nothing will show and the entire file not being able to show anything in {!! !!}
or {{ }}
tags.
resources/views/_layouts/defualt.blade.php
Is that a typo? Can you also post your entire default view.
That is correct. I have the code below.
<head>
<meta charset="utf-8">
<title>@yield('title')</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
{!! HTML::style('css/bootstrap.css') !!}
{!! HTML::style('css/font-awesome.css') !!}
{!! HTML::style('css/templatemo_style.css') !!}
{!! HTML::style('css/templatemo_misc.css') !!}
{!! HTML::style('css/flexslider.css') !!}
{!! HTML::style('css/testimonails-slider.css') !!}
{!! HTML::script('js/vendor/modernizr-2.6.1-respond-1.1.0.min.js') !!}
</head>
<body>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an outdated browser. <a href="http://browsehappy.com/">Upgrade your browser today</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to better experience this site.</p>
<![endif]-->
<header>
<div id="top-header">
<div class="container">
<div class="row">
<div class="col-md-6">
<div class="home-account">
@if (Auth::check())
{!! HTML::linkRoute('logout', 'Logout') !!}
@else
{!! HTML::linkRoute('login', 'Login') !!}
@endif
</div>
</div>
<div class="col-md-6">
<div class="cart-info">
Welcome Back,
@yield('topname')
</div>
</div>
</div>
</div>
</div>
<div id="main-header">
<div class="container">
<div class="row">
<div class="col-md-3">
<div class="logo">
<a href="#"><img src="http://ccba.demo.accessdrive.net/images/logo.png" ></a>
</div>
</div>
<div class="col-md-6">
<div class="main-menu">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="about-us.html">About</a></li>
<li><a href="products.html">Products</a></li>
<li><a href="contact-us.html">Contact</a></li>
</ul>
</div>
</div>
<div class="col-md-3">
<div class="search-box">
<!--<form name="search_form" method="get" class="search_form">
<input id="search" type="text" />
<input type="submit" id="search-button" />
</form>-->
@yield('search')
</div>
</div>
</div>
</div>
</div>
</header>
<div id="heading">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="heading-content">
<h2>@yield('title')</h2>
</div>
</div>
</div>
</div>
</div>
<div id="product-post">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="heading-section">
<h2>@yield('pageh2')</h2>
{!! HTML::image('images/under-heading.png') !!}
</div>
</div>
</div>
<div id="contact-us">
@yield('main')
</div>
</div>
</div>
<footer>
<div class="container">
<div class="top-footer">
<div class="main-footer">
</div>
<div class="bottom-footer">
<p>Copyright © 2084 <a href="#">Your Company Name</a> - Designed and Hosted by <a href="accessdrive.net">Accessdrive.net</a></p>
</div>
</div></div>
</footer>
{!! HTML::script('js/vendor/jquery-1.11.0.min.js') !!}
{!! HTML::script('js/vendor/jquery.gmap3.min.js' ) !!}
{!! HTML::script('js/plugins.js') !!}
{!! HTML::script('js/main.js') !!}
<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false">
</script>
</body>
</html>
Just quick notice.....I can't find "@stop" in documentation for section. All i found is:
@section('content')
<p>This is my body content.</p>
@endsection
Try changing this
Edit: I checked in code and see @stop should work same as @endsection....but in docs v5.1 there is no mention of @stop
BostjanOb said:
Just quick notice.....I can't find "@stop" in documentation for section. All i found is:
@section('content') <p>This is my body content.</p> @endsection
Try changing this
Edit: I checked in code and see @stop should work same as @endsection....but in docs v5.1 there is no mention of @stop
I have seen that as well and have tried both in the code with the same results.
That is correct.
You spelled "default" as "defualt" so that should be a typo.
Also your default view is missing the opening html tag and a doctype declaration.
I would also say that your first example's topname isn't showing because you didn't properly close your title section. I'm not sure why your main section is not working though. ChristianGerdes's example should have worked.
Ok, I did go ahead and created a new project and moved over my files and everything is working as expected. Could this happen due to an file not being copied over correctly?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community