Re: PHP and HTML, and how to access PHP variables from HTML

On Fri, Jul 15, 2005 at 03:19:11PM -0400, jim sullivan wrote:
>    This is a general question on how to reference script variables from HTML,

You don't. HTML is a document description language, not a programming
language. It has methods to hook scripting into it, but all the
variable handling must be done in the languges that are hooked not in
the HTML itself.

>    although the example I use is with PHP.

As far as I'm aware, client side support for PHP is nil.

>    <?php
>    foreach(glob("*.jpg") as $imagefile)
>    {
>    ?>
>    <img src=$imagefile title="$imagefile">
>    <?php
>    }
>    ?>

That would be an example of PHP being used to author an HTML document
on the fly. Since HTML is just a matter of the syntax of the output
format (You should have quotes around the value of the src attribute,
you are missing the required alt attribute, and the filename of the
image is unlikely to be useful advisory information), your question
would be better addressed to a PHP discussion list rather then one for
the discussion of the future design of HTML.

-- 
David Dorward                                      http://dorward.me.uk

Received on Saturday, 16 July 2005 11:45:40 UTC