← Back to team overview

nxhtml team mailing list archive

Re: [Question #43320]: Problem with formatting of PHP + HTML

 

Question #43320 on nXhtml changed:
https://answers.launchpad.net/nxhtml/+question/43320

    Status: Answered => Open

Pierre Dumuid is still having a problem:
----------------
Latest result is:
---------------
<table>
  <tr>
    <td>
      <table>
        <tr>
          <td>Hello</td>
        </tr>
     <?php
       for ($i=1;$i<5; $i++) {
         if (1) {
           echo "<tr><td>foobar</td></tr>";
         }
         if (1) {
           if (1) {
             if (1) {
        ?>
        <tr>
          <td>
            <p>random text.</p>
          <td>
        </tr>
      <?php
             }
           }
         }
         $foo = "test".bar;
         for ($i=1;$i<5; $i++) {
           if () {
           }
         }
       }
        ?>
     </table>
    </td>
  </tr>
</table>
----------------
I've decided to take out the bracket's altogether.

I found that I could make the second HTML chunk match the indentation of
the first HTML chunk by indenting the <?php as you asked for.  It
appears however that doing so indents the PHP code as well.

There is now two tab's and 1 space after the second <?php.

I have observed that if I manually correct the first lines after all the "<?php" bits of text, the indenting becomes correct as follows:
---------------
<table>
  <tr>
    <td>
      <table>
        <tr>
          <td>Hello</td>
        </tr>
     <?php
for ($i=1;$i<5; $i++) {
  if (1) {
    echo "<tr><td>foobar</td></tr>";
  }
  if (1) {
    if (1) {
      if (1) {
        ?>
        <tr>
          <td>
            <p>random test.</p>
          <td>
        </tr>
        <?php
      }
    }
  }
  $foo = "test".bar;
  for ($i=1;$i<5; $i++) {
    if () {
    }
  }
}
?>
     </table>
    </td>
  </tr>
</table>

-- 
You received this question notification because you are a member of
nXhtml, which is an answer contact for nXhtml.