Re: Creating an Entire .html page with PHP

From: Date: Tue, 26 Jan 2010 02:17:54 +0000
Subject: Re: Creating an Entire .html page with PHP
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-301438@lists.php.net to get a copy of this message
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@gmail.com [db-10]

« previous php.general (#301438) next »