We help IT Professionals succeed at work.

What is a "section id" in Laravel

Bruce Gust
Bruce Gust used Ask the Experts™
on
New to Laravel. Going through some tutorials and I'm working with a Bootstrap template. On the "welcome.blade.php" file, there's a section that looks like this:

 <!-- Section: intro -->
    <section id="intro" class="intro">
        <div class="intro-content">
            <div class="container">

From what I understand, you're going to use a layout and at one point you'll have a "@yield('content')," which is Blade's way of allowing for content coming from a section called "content."

But I've not found anything in the instructional material that references "id's."

What is the significance of a "section id?"
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Laravel is a PHP framework.

The <section> tag is HTML5.

https://www.w3schools.com/tags/tag_section.asp provides a good <section> tag overview.
Bruce GustPHP Developer

Author

Commented:
Thanks, David!

I read through the content of the article you reference and it's good info, but it doesn't explain how the "id" dynamic works related to Laravel, or at least I'm missing it.
David FavorFractional CTO
Distinguished Expert 2018
Commented:
This may or may not be directly related to Laravel.

You'll just have to dig into the Laravel docs, as this is more likely some library Laravel is leveraging to render HTML.

Another way of saying this is...

1) Laravel produces PHP.

2) Apps written leveraging the Laravel framework generate HTML.

3) So likely whatever App you're using with Laravel contains the concept of what ids are generated, so if you change the App you're using, you may have an entirely different setup of <section> tags or more likely HTML which contains no <section> tags at all.

Likely someone who uses Laravel will chime in shortly to correct me, if I'm incorrect.
Most Valuable Expert 2018
Distinguished Expert 2018
Commented:
Hey Bruce.

The <section id="intro"> has nothing to do with Laravel. It's basic HTML5. A <section> is an HTML element, in the same way that a <div> is an HTML element. It's just a wrapper.

Every HTML element has a base set of properties - the id is one of them, which is why you can have this:

<div id="customer-detail">...</div>
<section id="intro">...</section>

You can use the ID to hook into the elements using CSS selectors. You can use them in your CSS files for styling:

#intro { color: red; }

And you can use them in your scripts for selecting:

$('#intro).hide();

Laravel does have a concept of sections, but this is not what you have above. The blade engine uses @section directives to define areas that are pushed into templates (using @yield)
Bruce GustPHP Developer

Author

Commented:
Thank you, gentlemen!
David FavorFractional CTO
Distinguished Expert 2018

Commented:
You're welcome!

Good luck!