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>";
Sign up to request clarification or add additional context in comments.

Comments

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

Comments

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%\">"

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.