2

I'm trying to comment out the snippet between ~/**********/~ in the below code inside of a php function:

       $photobody[]="<tr><td colspan=\"".$cols."\">
        <table width=\"100%\" border=\"0\">
        <tr><td width=\"33%\">
        <div align=\"left\" class=\"caption\">".$prev."</div></td>
        <td width=\"33%\">                         
    ~/***** <div align=\"center\" class=\"caption\">Photos 
        <strong>".($photonum-(($rows*$cols)-1))."</strong> to 
        <strong>".$endnum."</strong> of 
        <strong>".count($photos)."</strong>
    <br />".$photopage."</div> ****/~ 
        </td><td width=\"33%\">
        <div align=\"right\" class=\"caption\">".$next."</div></td></tr></table></td></tr>";

Having some difficulty. Is there something that I need to escape to get that section to comment out? Little help. Thanks.

1

3 Answers 3

2

The section you want to comment is of pure HTML type. Thus you need to put HTML comment as shown:-

$photobody[]="<tr><td colspan=\"".$cols."\">
    <table width=\"100%\" border=\"0\">
    <tr><td width=\"33%\">
    <div align=\"left\" class=\"caption\">".$prev."</div></td>
    <td width=\"33%\">                         
<!-- <div align=\"center\" class=\"caption\">Photos 
    <strong>".($photonum-(($rows*$cols)-1))."</strong> to 
    <strong>".$endnum."</strong> of 
    <strong>".count($photos)."</strong>
<br />".$photopage."</div> --> 
    </td><td width=\"33%\">
    <div align=\"right\" class=\"caption\">".$next."</div></td></tr></table></td></tr>";
1

For commenting used <!-- -->

$photobody[]="<tr><td colspan=\"".$cols."\">
        <table width=\"100%\" border=\"0\">
        <tr><td width=\"33%\">
        <div align=\"left\" class=\"caption\">".$prev."</div></td>
        <td width=\"33%\">                         
  <!--<div align=\"center\" class=\"caption\">Photos 
        <strong>".($photonum-(($rows*$cols)-1))."</strong> to 
        <strong>".$endnum."</strong> of 
        <strong>".count($photos)."</strong>
    <br />".$photopage."</div> -->
        </td><td width=\"33%\">
        <div align=\"right\" class=\"caption\">".$next."</div></td></tr></table></td></tr
0

You should close the previous string with an extra " in order for the text after /* to be a comment:

    "<td width=\"33%\">"                         
    /***** <div align=\"center\" class=\"caption\">Photos 
    <strong>".($photonum-(($rows*$cols)-1))."</strong> to 
    <strong>".$endnum."</strong> of 
    <strong>".count($photos)."</strong>
<br />".$photopage."</div> ****/
    "</td><td width=\"33%\">"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.