How to comment blocks of php without commented out html ending up in the source?

已回答

In the IDE I switched from (Dreamweaver), I could comment out a block of PHP code with mixed html, without any of the html ending up as commented out code in the source.

Example of Dreamweaver style php block commenting:

Original code:

<?php if ( $search = 1) : ?>
<div class="search">
</div>
<?php endif; ?>

Dreamweaver php block comment:

<?php /*?><?php if ( $search = 1) : ?>
<div class="search">
</div>
<?php endif; ?><?php */?>

Result: nothing in frontend source.

However with PHPSstorm the only block commenting option I can find leads to commented out html in the source:


PHPstorm on OSX, with CMD-SHIFT-/
Leads to commented out html in source

<?php /*if ( $search = 1) : */?><!--
<div class="search">
</div>
--><?php /*endif; */?>

which leads to this in the frontend source:

<!--
<div class="search">
</div>
-->

Is there a way to achieve this kind of commenting that I am missing?


If not I would like to suggest this as a feature request, I used this all the time to comment out code I am temporarily not using but want to keep.

0

Hi there,

AFAIK it's the way how it always worked and it's not configurable.

You can file Feature Request ticket at Issue Tracker: https://youtrack.jetbrains.com/issues/WI (but please check for possibly existing tickets first -- there and in https://youtrack.jetbrains.com/issues/WEB as well).

P.S.

Partially related:

1

Ok, will do. Thanks.

 

0

请先登录再写评论。