You are here: Re: Writing static file from dynamic PHP page « PHP « IT news, forums, messages
Re: Writing static file from dynamic PHP page

Posted by Matthew Weier O'Phinney on 01/18/05 06:05

* Chris Bruce <chris@idextrus.com>:
> I am looking for a way to write to a file what the browser would see
> (raw html) when viewing a dynamic PHP page. I have numerous include
> files, MySQL db queries, loops etc. and I want to generate the static
> result of that file and save it as an html page. I have toyed a little
> with output buffering to no avail.

The key to doing this sort of thing is to *NOT* echo everything as you
receive it. Store content in variables and echo once you've finished.

If this is not an option, I've seen any number of good threads on using
output buffering in recent weeks on this list; peruse them, see what has
worked for others, and try those methods; if they don't work, ask the
list for help -- and include that information (what you tried, what you
expected, what you received).

If it *is* an option, Cache_Lite from PEAR is an excellent class for
doing exactly what you're trying to do.

--
Matthew Weier O'Phinney | mailto:matthew@garden.org
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация