Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yield don't support 2 files having section for that yield #8

Open
Jarzebowsky opened this issue Mar 22, 2018 · 6 comments
Open

yield don't support 2 files having section for that yield #8

Jarzebowsky opened this issue Mar 22, 2018 · 6 comments

Comments

@Jarzebowsky
Copy link

Blade has it resolved and here is article (https://vijayasankarn.wordpress.com/2017/02/03/add-multiple-contents-to-yield-from-section/) what's the problem and how to solve it, can we get that on that library? I'm talking about @Push and @stack.

@davideloba
Copy link

@Jarzebowsky You can append contents of your section using @section@show placeholder, instead of @yield, for example:

master.slice.php

@section('mySection')
//your content here
@show

sub.slice.php

@extends('master')
@section('mySection')
//content to append here
@endsection

@Jarzebowsky
Copy link
Author

Jarzebowsky commented Mar 29, 2018

@davideloba Is it a proper way to do it?

@davideloba
Copy link

@Jarzebowsky
for me this works, let me know:

master.slice.php
@section('mySection')
//your content here
@show

sub.slice.php
@extends('master')
@include('subOne')
@include('subTwo')

subOne.slice.php
@section('mySection')
//first content to append here
@endsection

subTwo.slice.php
@section('mySection')
//second content to append here
@endsection

@Jarzebowsky
Copy link
Author

I know what you are talking about, but thats (https://laravel.com/docs/5.6/blade#stacks) exactly what I'm missing.

@davideloba
Copy link

I know blade @stack @Push features but as far I can see, Slice doesn't have something like that. For my purposes (appending contents from different subviews) that workaround does what I need.

@Jarzebowsky
Copy link
Author

What about if I give some1 an ability to create module to my CMS, without giving him access to main view to make him include his section he created?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants