From: Shawn McKenzie on 25 Jan 2010 21:23 dealtek(a)gmail.com 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(a)gmail.com > [db-10] > file_put_contents() is soooo much easier. -- Thanks! -Shawn http://www.spidean.com
From: "dealtek on 25 Jan 2010 21:31 On Jan 25, 2010, at 6:23 PM, Shawn McKenzie wrote: > file_put_contents() is soooo much easier. Thanks Shawn I'll check that out ... - I see it says : This function is identical to calling fopen(), fwrite() and fclose() successively to write data to a file. my newbie brain likes that! Thanks, dealtek(a)gmail.com [db-10]
From: Ryan Sun on 26 Jan 2010 09:55 Isn't there a framework doing that? On Mon, Jan 25, 2010 at 8:00 PM, dealtek(a)gmail.com <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] > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
From: Ashley Sheridan on 26 Jan 2010 10:04 On Tue, 2010-01-26 at 09:55 -0500, Ryan Sun wrote: > Isn't there a framework doing that? > > On Mon, Jan 25, 2010 at 8:00 PM, dealtek(a)gmail.com <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] > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > I think generally though, it's usual to have the pages created and output on the fly, rather than output the .html page. Some CMS's do publish the .html pages, but unless the page is created from very complex content, or your site is expecting a large amount of traffic, there's not much use to do it. I've heard people mention SEO as a reason, but I've not seen any evidence, and there are ways via mod_rewrite to mask the actual content pages. Thanks, Ash http://www.ashleysheridan.co.uk
From: "Michael A. Peters" on 26 Jan 2010 10:45
Ashley Sheridan wrote: >>> > > > I think generally though, it's usual to have the pages created and > output on the fly, rather than output the .html page. Yes, though often using a cache if it is dynamic content that doesn't change often. No reason to hit the db continuously if the content is the same as when you hit it the last 278 times. |