Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9068525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:12:46+00:00 2026-06-16T17:12:46+00:00

I’ll follow some tutorials about Laravel 3, and know, I have a problem, with

  • 0

I’ll follow some tutorials about Laravel 3, and know, I have a problem, with one:

@section('post_navigation')
@if(Auth::check())
    @include('plugins.loggedin_postnav')
@endif
@endsection

Why this section not appear?

I try remove all content in section, for example;

@section('post_navigation')
    <h1>Test</h1>
@endsection

But doesn’t work.

The complete code is that:

<div class="navbar navbar-inverse navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container">
            {{ HTML::link('/', 'Instapics', array('class' => 'brand')); }}

            <div class="nav-collapse">
                <ul class="nav">
                    @section('navigation')
                        <li class="active">{{ HTML::link('/', 'Home') }}</li>
                    @yield_section
                </ul>
            </div>

            @section('post_navigation')
            @if(Auth::check())
                @include('plugins.loggedin_postnav')
            @endif
            @endsection

        </div>
    </div>
</div>

[EDIT]
I change @endsection to @yield_section, and works, BUT, I still not understand, for example (in User_Controller index view):

@section('post_navigation')
    @parent
@endsection

Why not appear the include?

Why I need change endsection to yield_section?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T17:12:47+00:00Added an answer on June 16, 2026 at 5:12 pm

    When you use @section, you define a section like defining a variable. Then, you can use it where you want by @yield('sectionname') (or by using another way I specified in the second paragraph). For example, you can look at this:

    @section('scripts')
        <script src="jquery.js"></script>
    @endsection
    
    <head>
        @yield('scripts')
    </head>
    

    @section / @endsection and @section / @yield_section are not same. @section / @yield_section defines a section area, not a section. In other words, it calls a variable. Actually it is more similar to yield(‘sectionname’) than @section / @endsection. It has default value as a main difference from yield.

    You can define an area which has default value, and then you can change it by defining a section. This logic mostly used while creating and using layouts. For example, Let below page be our main (main.blade.php) layout.

    <html>
        <head>
            <title>
            @section('title')
            Default Title Maybe Sitename.com
            @yield_section
            </title>
            @include('scripts')
        </head>
        <body>
            <div id="content">
            @section('content')
                Default content
            @yield_section
            </div>
            <div id="sidebar">
            @section('sidebar')
                <ul id="menu">
                    <li><a href="#">Menu item 1</a></li>
                    <li><a href="#">Menu item 2</a></li>
                    <li><a href="#">Menu item 3</a></li>
                    <li><a href="#">Menu item 4</a></li>
                </ul>
            @yield_section
        </body>
    </html>
    

    Generally layouts are not used directly. Another page is created and specified in the page its layout like @layout('main'). Then, sections are defined and laravel templating system change the defined section. Let this page be our post (post.blade.php) page:

    @layout('main')
    
    @section('title')
    $post->title - @parent
    @end_section
    
    @section('content')
    $post->content
    @end_section
    

    When we return post view View::make('profile');, as you can see, layout logic will work and sections in main.blade.php will be changed with we defined in this page. So, the output will be:

    <html>
        <head>
            <title>
            Post title - Default Title Maybe Sitename.com
            </title>
            <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
        </head>
        <body>
            <div id="content">
                Post content
            </div>
            <div id="sidebar">
                <ul id="menu">
                    <li><a href="#">Menu item 1</a></li>
                    <li><a href="#">Menu item 2</a></li>
                    <li><a href="#">Menu item 3</a></li>
                    <li><a href="#">Menu item 4</a></li>
                </ul>
        </body>
    </html>
    

    By the way, @parent returns default value in section area and @include is same logic with include in php.

    Have a nice day.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have been unable to fix a problem with Java Unicode and encoding. The
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.