Re: Creating an Entire .html page with PHP

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

 



dealtek@xxxxxxxxx wrote:
> 
> On Jan 25, 2010, at 4:59 PM, Ashley Sheridan wrote:
> 
> 
>>
>> $fh = fopen("page.html","w");
>> fwrite($fh, $htmlcode);
>>
>>
>>
> 
> Thanks so much Ashley and ALL, this looks like it will work fine.
> 
> BTW: Sorry if I didn't make myself clear - I just wanted to grab some
> data like a person from a contacts file and be able to save a static
> .html web page with their data - etc.
> 
> ... this little test seems to work
> 
> I added fclose($fh); at the end (correct?)
> 
> 
> - - - - - -
> 
> 
> <?php
> 
> // got some data with query 'get'...
> 
> $addthis = ' my name is:  ';
> 
> $fh = fopen("testpage.html","w");
> 
> $htmlcode = '<!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>
> 
> this is a test<br /><br />'.$addthis.'<br />'.$row_get['FirstName'].'
> '.$row_get['LastName'].'<br />
> 
> this is a test 2
> 
> 
> </body>
> </html>
> ';
> 
> 
> fwrite($fh, $htmlcode);
> 
> fclose($fh);
> 
> ?>
> 
> 
> 
> 
> 
> Thanks,
> dealtek@xxxxxxxxx
> [db-10]
> 

file_put_contents() is soooo much easier.

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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