Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to comment code in blades like laravel 4?

I have migrated my app from laravel 4.2 to laravel 5

I am currently having this problem, when even I have old comments like this:

{{--{{link_to_route('language.select', 'English', array('en'))}}--}}

Will result into error at laravel 5, I will have this error:

FatalErrorException in 18b6386ebc018eb0c0e76f105eba4286 line 263:
syntax error, unexpected '{'

which is compiled into:

 <?php echo --{{link_to_route('language.select', 'English', array('en')); ?>--}}

I already added laravel 4 backward comparability support at register@ServiceProvider as:

\Blade::setRawTags('{{', '}}');
\Blade::setContentTags('{{{', '}}}');
\Blade::setEscapedContentTags('{{{', '}}}');

but how can I add laravel 4 backward comparability for comments {{-- --}} ?

edit:

how to comment this in laravel 5:

<li {{ (Request::is('/') ? ' class="active"' : '') }}><a href="{{{ URL::to('') }}}">{{trans('messages.Home')}}</a></li>
like image 740
Samir Sabri Avatar asked May 13 '15 14:05

Samir Sabri


People also ask

What is Blade template in laravel?

Blade is the simple, yet powerful templating engine that is included with Laravel. Unlike some PHP templating engines, Blade does not restrict you from using plain PHP code in your templates.


1 Answers

Since you change your content tags from {{ to {{{ comment tags are now {{{-- not {{--

like image 114
Pawel Bieszczad Avatar answered Oct 03 '22 23:10

Pawel Bieszczad