Support the ongoing development of Laravel.io →
posted 8 years ago
Views Blade
Last updated 1 year ago.
0

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...

Last updated 8 years ago.
0

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.

0

resources/views/_layouts/defualt.blade.php

Is that a typo? Can you also post your entire default view.

0

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,400...' 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=AIzaSyDY0kkJiTPVd2U...;>
        </script>
    </body>
</html>
Last updated 8 years ago.
0

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

Last updated 8 years ago.
0

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.

0

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.

0

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?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

mbsmi mbsmi Joined 21 Nov 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.