NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP-related book comments

Chris Shiflett shiflett at php.net
Wed Jul 14 19:48:07 EDT 2004


--- David Sklar <sklar at sklar.com> wrote:
> Chris Shiflett wrote:
> 
> > Here's why it annoys me. Run this code:
> > 
> > <table>
> >    <tr>
> >       <td>
> >          <? echo 'Foo'; ?>
> >       </td>
> >    </tr>
> > </table>
> > 
> > You'll get this:
> > 
> > <table>
> >    <tr>
> >       <td>
> >          Foo      </td>
> >    </tr>
> > </table>
> > 
> > Yuck. :-)
> > 
> > The reasoning behind this, as I understand it, is simply to help avoid
> > problems caused by undesired output at the end of included files. It
> > seems that there is surely a way to avoid the problem without
resorting
> > to this "solution," but I may be missing something important.
> 
> Do you want the output to be:
> 
> <table>
>      <tr>
>         <td>Foo</td>
>      </tr>
>   </table>

Nope, I want it to leave everything alone that is not within PHP tags,
thus:

<table>
   <tr>
      <td>
         Foo
      </td>
   </tr>
</table>

I don't want the newline that I intentionally put after the closing PHP
tag to be stripped.

> What if your code is:
> 
> <pre>
> Top Level
>      Next Level
>           <?php print $relevant_info; ?>
>      End Next Level
> End Top Level
> </pre>
> 
> Then, the whitespace is important.

Yes, so I would prefer it not output this:

<pre>
Top Level
     Next Level
          Foo     End Next Level
End Top Level
</pre>

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming Fall 2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/



More information about the talk mailing list