From: "dealtek on
Hi Folks,

I would like to create an entire .html page gathered from database
content mixed with html etc. and be able to save the page...


like:

--- save all this pre made content as .html page....

<html>
<head>
.... stuff
</head>
<body>
.... stuff
.... stuff with database query results...
.... stuff
</body>
</html>

Q: Is there a function that might help with saving the whole content
as .html page?



Thanks,
dealtek(a)gmail.com
[db-10]

From: Ashley Sheridan on
On Mon, 2010-01-25 at 17:00 -0800, dealtek(a)gmail.com wrote:

> Hi Folks,
>
> I would like to create an entire .html page gathered from database
> content mixed with html etc. and be able to save the page...
>
>
> like:
>
> --- save all this pre made content as .html page....
>
> <html>
> <head>
> ... stuff
> </head>
> <body>
> ... stuff
> ... stuff with database query results...
> ... stuff
> </body>
> </html>
>
> Q: Is there a function that might help with saving the whole content
> as .html page?
>
>
>
> Thanks,
> dealtek(a)gmail.com
> [db-10]
>
>


$fh = fopen("page.html","w");
fwrite($fh, $htmlcode);


Thanks,
Ash
http://www.ashleysheridan.co.uk


From: "Angus Mann" on
----- Original Message -----
From: <dealtek(a)gmail.com>
To: "PHP-General" <php-general(a)lists.php.net>
Sent: Tuesday, January 26, 2010 11:00 AM
Subject: [PHP] Creating an Entire .html page with PHP


> Hi Folks,
>
> I would like to create an entire .html page gathered from database
> content mixed with html etc. and be able to save the page...
>
>
> like:
>
> --- save all this pre made content as .html page....
>
> <html>
> <head>
> ... stuff
> </head>
> <body>
> ... stuff
> ... stuff with database query results...
> ... stuff
> </body>
> </html>
>
> Q: Is there a function that might help with saving the whole content as
> .html page?
>
>
>
> Thanks,
> dealtek(a)gmail.com
> [db-10]

Not really...no. The fact that you're asking this question makes me think
you should start with a less ambitious goal than you describe. Terms like
"saving the whole content as a .html page" and "content mixed with html" are
pretty meaningless, I'm afraid.

Try generating a few ordinary pages before you throw a database into the
mix.

From: Al on


On 1/25/2010 8:00 PM, dealtek(a)gmail.com wrote:
> Hi Folks,
>
> I would like to create an entire .html page gathered from database
> content mixed with html etc. and be able to save the page...
>
>
> like:
>
> --- save all this pre made content as .html page....
>
> <html>
> <head>
> ... stuff
> </head>
> <body>
> ... stuff
> ... stuff with database query results...
> ... stuff
> </body>
> </html>
>
> Q: Is there a function that might help with saving the whole content as
> .html page?
>
>
>
> Thanks,
> dealtek(a)gmail.com
> [db-10]
>

rename(APPLIC_DB_FILE, APPLIC_DB_FILE . 'BAK'); //make a backup
$serTxt = serialize($dbTable);
if(!file_put_contents(APPLIC_DB_FILE, $serTxt, LOCK_EX))
die("<div style=\"color:red; margin:10em auto auto auto\">Major error in
upDateDBTable(). Contact tech support</div>");

$dbTable = unserialize(file_get_contents(APPLIC_DB_FILE)); //Current application
file


From: "dealtek on

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(a)gmail.com
[db-10]