Reputation: 7956
In Notepad++ I want temporary turn of this block of code:
Number of registered users: <?php echo $objUsers->users['total']; ?><br/>
Newest user: <?php echo $objUsers->users['last']; ?>
<h5>Online users:</h5> <?php echo $objUsers->users['online']; ?>
html comment markup - doesn't work.
php comment markup - doesn't work.
I can't believe that I must comment separately html and php code - 3+3 times ?
Upvotes: 1
Views: 14122
Reputation: 1193
You can comment out all of your code by surrounding the whole thing in a PHP block comment. It would look something like:
<?php /* ?>
Number of registered users: <?php echo $objUsers->users['total']; ?><br/>
Newest user: <?php echo $objUsers->users['last']; ?>
<h5>Online users:</h5> <?php echo $objUsers->users['online']; ?>
<?php */ ?>
Of course, putting the block comments in a separate PHP tag is not necessary. A reduced version looks like:
<?php /* ?>
Number of registered users: <?php echo $objUsers->users['total']; ?><br/>
Newest user: <?php echo $objUsers->users['last']; ?>
<h5>Online users:</h5> <?php echo $objUsers->users['online']; */ ?>
Upvotes: 7
Reputation: 354
You have to use both html markups and php comment chars in php block. E.g.
<!-- Number of registered users: <?php //echo $objUsers->users['total']; ?><br/>
Newest user: <?php // echo $objUsers->users['last']; ?>
<h5>Online users:</h5> //<?php echo $objUsers->users['online']; ?> -->
Better comment each line out as:
<!-- Number of registered users: <?php //echo $objUsers->users['total']; ?><br/> -->
<!-- Newest user: <?php // echo $objUsers->users['last']; ?> -->
<!-- <h5>Online users:</h5> //<?php echo $objUsers->users['online']; ?> -->
Upvotes: 2
Reputation: 90776
Just wrap the code in HTML comments:
<!--
Number of registered users: <?php echo $objUsers->users['total']; ?><br/>
Newest user: <?php echo $objUsers->users['last']; ?>
<h5>Online users:</h5> <?php echo $objUsers->users['online']; ?>
-->
Upvotes: 3