framework: blade php tag doesn't get commented
- Laravel Version: 5.5
- PHP Version: 7.0.18
- Database Driver & Version: mysql
Hi, I have this code that is commented by {{-- --}} tags:
{{--
@php
$i=-1;
@endphp
@foreach($mostLikedProducts as $instagramMedia)
@php
$i++;
$arrayPrice = price_format($instagramMedia->products->price);
$price = $arrayPrice['num'];
$priceUnit = $arrayPrice['unit'];
@endphp
<section class="section-padding cl popular-product">
<div class="col-14 content-wrap">
<strong class="text-primary">{{ $instagramMedia->like }} {{ trans('instagram.likes') }}</strong>
<a href="{{ url(productUrl($instagramMedia->products))}}" class="" title="{{$instagramMedia->products->title}}" >
<h2 class="no-side-margin text-xl">{{ $instagramMedia->products->title }}</h2>
</a>
<p class="opacity-75 text-md">{{ $instagramMedia->products->description }}</p><br><br>
</div><!-- /.figcaption -->
@if($i % 2 != 0)
<div class="img-wrap col-10">
<img src="{{ $instagramMedia->products->media->link }}" alt="{{ $instagramMedia->products->title }}">
</div>
@endif
</section>
<hr>
@endforeach
--}}
But the part in php tags doesn’t get comment and this is the error:
Line 538 those codes are in php tags also $i=-1 is in php tags that is commented.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 16 (3 by maintainers)
If i’m not mistaken, the comments only work inline. So I don’t see this as a bug. You can close the issue
As the PR got closed, the chances of this bug getting fixed is low 😛
Ya as @36864 (why no name man 😛 ) pointed out this isn’t a bug and the issue can be closed.
Sorting this tonight
You’ve commented out a section where you loop over
$mostLikeProducts
. Further down there is a section that loops through$mostPopularTagProducts
.The snippet you showed clearly indicates that you’re looping through
$mostPopularTagProducts
and not$mostLikedProducts
.In other words, the comments are working just fine (compiled the view myself to confirm) and the problem lies in your code, not the framework.
This is the kind of thing that tends to happen when you have over 1000 lines in a single blade file.