Re: Newbie Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 1, 2011, at 8:37 PM, Adolfo Olivera wrote:

> Sorry, here is the code. The .php extension is a requirement? Can't it b embedded on a .html file?
> 
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> 
> <html xmlns="http://www.w3.org/1999/xhtml";>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
> <title>Untitled Document</title>
> 
> </head>
> <body>
> <?php
> $a = "hello";
> $hello ="Hello Everyone";
> echo $a;
> echo $hello;
> ?>
> </body>
> </html>
> 
> On Sat, Jan 1, 2011 at 9:55 PM, Joshua Kehn <josh.kehn@xxxxxxxxx> wrote:
> On Jan 1, 2011, at 7:50 PM, David Robley wrote:
> >
> > And normally would need to be saved as a .php file so the contents will be
> > handled by php.
> >
> >
> > Cheers
> > --
> > David Robley
> >
> > A fool and his money are my two favourite people.
> > Today is Boomtime, the 2nd day of Chaos in the YOLD 3177.
> 
> Save the code as hello.php. Copy it to your root web directory (should be the base directory or something called public_html / www when you FTP in) and access it from youdomain.com/hello.php
> 
> Regards,
> 
> -Josh
> ____________________________________
> Joshua Kehn | Josh.Kehn@xxxxxxxxx
> http://joshuakehn.com
> 


Yes it _can_ be embedded alongside HTML code, but it must have the .php extension otherwise it won't be picked up as a PHP file. You could add a .htaccess rule to change the processing directive (essentially make every HTML file a PHP file) but that would be wasteful if you ever serve straight HTML. 

Regards,

-Josh
____________________________________
Joshua Kehn | Josh.Kehn@xxxxxxxxx
http://joshuakehn.com


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux