On Tue, 2007-04-17 at 22:10 -0400, William Case wrote:
> On Tue, 2007-04-17 at 21:13 -0400, Glenn Henshaw wrote:
> > On 17-Apr-07, at 7:08 PM, William Case wrote:
> >
> > > Hi;
> > >
> > > I got the 'Hello World' practice file working then began playing with
> > > it. My problem is getting the commenting out to work. I have
> > > obviously
> > > missed something.
> > >
> > > Here is the little program:
> > > <html>
> > > <head>
> > > <title>'PHP Test'</title>
> > > </head>
> > >
> > > <body>
> > >
> > > <?php echo '<p>Hello World</p>' ?>
> > >
> > > <!--
> > > <?php
> > > if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
> > ?> <!-- missing -->
> > > <h3>'strpos()must have returned non-false'</h3>
> > > <p>'You are using Internet Explorer'</p>
> > >
> Ah! Thanks, that was what I was looking for. I don't mind that kind of
> learning mistake. I usually chase them down as part of the learning
> process.
>
> > > <?php
> > > } else {
> > > ?>
> > >
> > > <h3>'strpos() must have returned false'</h3>
> > > <p>'You are not using Internet Explorer.'</p>
> > >
> > > <?php
> > > }
> > > ?>
> > > -->
> > >
> > > </body>
> > >
> > > </html>
> > >
> > >
> > > <?php /*phpinfo();*/ ?>
> > >
> > > The HTML manual told me to use <!-- and --> to make comments. The
> > > body
> > > outside of the comment tags worked on my browser as it should. The
> > > stuff in between <!-- ... --> is things that I am trying out (playing
> > > with). I wanted to comment out the stuff in order to find the error
> > > causing the blank screen that I am getting on my browser. My main
> > > concern and to which I don't seem to be able to find an answer is
> > > how to
> > > comment out properly.
> >
> > I believe that the HTML comments are interpreted by the browser.
> > The PHP inside the comments will still be executed on the server.
> >
>
> Is there no way then, that I can comment out code like in C and start
> working backwards to solve a coding problem. It's too early in the game
> for me to start learning how to run a HTTP or PHP debugger. Not being
^^^^ should be HTML
> able to do something simple to solve another problem is where the real
> frustration was coming into it.
>
> > >
> > > Similarly, <?php /*phpinfo();*/ ?> at the bottom is something I
> > > used to
> > > experiment with commenting out in PHP. Originally I had /*
> > > <?php /*phpinfo(); ?> */ placed where it is now -- outside of HTML or
> > > any other tags yet the string showed up on my browser screen. That
> > > doesn't make sense to me. So, why?
> >
> > In the original line, the comment delimiter is outside the php
> > tags. You need to watch that the HTML and php are well separated.
>
> Now I am really confused. The file is a PHP file (help.php). Shouldn't
> the browser be reading the PHP comments tags after the end of the HTML
> code is closed off?
>
> >
> > ... Glenn
> >
--
Regards Bill