Author Topic: How to generate static HTML file  (Read 850 times)

Offline Argonisius

  • Level 4
  • *
  • Posts: 12
  • Reputation: +0/-0
    • View Profile
How to generate static HTML file
« on: February 14, 2010, 09:39:18 AM »
Hi, I'm thinking about a strategy game with big map. On that map will be many countries and informations about them.
Because of the many queries I would like to generate every night a static html file with that map. How can I do it in PHP?

Offline Nox

  • Level 35
  • **
  • Posts: 768
  • Reputation: +12/-2
    • View Profile
Re: How to generate static HTML file
« Reply #1 on: February 14, 2010, 10:22:37 AM »
Code: [Select]
<?php
if( !file_exists($filepath) )
{
  
ob_start();
  
//generation
  
file_put_contents$filepathob_get_flush() );
}
?>
« Last Edit: February 14, 2010, 12:06:47 PM by Nox »
Meet us at an IRC irc.freenode.net #bbg as well
https://vimeo.com/36579366 (a must-watch) | Join BOINC - no longer a hype, but you can help never the less

Offline Argonisius

  • Level 4
  • *
  • Posts: 12
  • Reputation: +0/-0
    • View Profile
Re: How to generate static HTML file
« Reply #2 on: February 14, 2010, 11:53:15 AM »
Thanks... But when I want to rewrite the file, I only have to delete this condition?:
Code: [Select]
if( !file_exists($filepath) )

Offline Nox

  • Level 35
  • **
  • Posts: 768
  • Reputation: +12/-2
    • View Profile
Re: How to generate static HTML file
« Reply #3 on: February 14, 2010, 12:07:13 PM »
Yes, as manual states
Quote
If filename does not exist, the file is created. Otherwise, the existing file is overwritten, unless the FILE_APPEND flags is set.
Meet us at an IRC irc.freenode.net #bbg as well
https://vimeo.com/36579366 (a must-watch) | Join BOINC - no longer a hype, but you can help never the less

Offline Andy

  • Level 7
  • *
  • Posts: 31
  • Reputation: +0/-1
    • View Profile
Re: How to generate static HTML file
« Reply #4 on: June 08, 2010, 09:38:35 AM »
I'm interested, what are you working on exactly apart from the map? Genre of game?

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal