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

[Request] Blade autoescaping and better documentation on @show/@stop #978

Closed
hugollm opened this issue Apr 17, 2013 · 7 comments
Closed

Comments

@hugollm
Copy link

hugollm commented Apr 17, 2013

Autoescaping sections:

@autoescape
    // suff
@endautoescape

Also providing a way to bypass the autoescaping for some entries. I would feel safer working with white lists instead of black ones.

Also, the docs need a better insight on Blade. There's no clue there about that new @show @stop thingy. I tried playing around with it and it just seems that it doesn't work well, unless you do exacly what the doc shows (@show on templates, @stop on pages). Does that mean the sections have to know if they will be overrided or not? If that's the case (i really don't know for sure), I think that's kinda limiting.

For last, and that's more of an observation than a request, I will really miss the non-blade syntax:

<?php Section::yield('body'); ?>

I find php a very good templating syntax already. Wish i could use blade's power directly in it :p

@taylorotwell
Copy link
Member

No sections don't know if they are being overridden or not. That would make no sense.

@taylorotwell
Copy link
Member

@Stop is just @endsection from L3.. @show is just @yieldSection

@hugollm
Copy link
Author

hugollm commented Apr 17, 2013

But, consider this blade:

{{-- template.blade.php --}}
@section('content')
<h1>hello template</h1>
@stop

and this:

{{-- page.blade.php --}}
@extends('template')

@section('content')
<h1>hello page</h1>
@stop

calling:

return View::make('page');

Using @stop on both displays nothing. Using @show displays "hello page" two times. It only works correctly if I put @show on the first one and @stop on the second, or @stop in the first and @show on the second. How can I write them "equally" and keeps the inheritance working?

@taylorotwell
Copy link
Member

Well, of course you have to put @show on teh first one.

@taylorotwell
Copy link
Member

That's how it works. It works well, lots of people use it like that all the time and there is no other possbile way it could even work. The autoescape thing is another issue.

@hugollm
Copy link
Author

hugollm commented Apr 17, 2013

So it does have to know it is the first one...
Sorry, i'm just trying to understand/help. Didn't mean to criticize at all.

@teknosains
Copy link

Im having the this issue too , following this reciepe : http://laravel-recipes.com/recipes/245/pulling-in-the-content-of-a-parent-section-in-blade

 @section('test')  
     Bottom
@stop

 {{-- Later --}}
@section('test')
  Top
 @show

will output this

Top
Bottom

but it actually only shows :
Bottom

@hugollm

@laravel laravel locked and limited conversation to collaborators Nov 10, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants