No announcement yet.

PHP generating HTML files

  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP generating HTML files

    Well, I've got a PHP script which get's results from a database, it's kinda a CMS though it's only for cheats (game), reviews and humor articles. Anyhow, I need to make it generate HTML pages, such as /archives/cheats/1.html (with 1 being the ID of the cheat, as they all have unique ID #'s). Now, I don't have a clue how to do it, I don't want it in a layout, just blank on a HTML page. It'd also be cool if I could have a Cron Job to redo it every day or so, so that it updates every day to new versions, etc.

    So, I goto /archive/ and index.html loads with:

    Cheats (linking to /archive/cheats/)
    Humor (linking to /archive/humor/)
    Reviews (linking to /archive/reviews/)

    Now, lets say someone clicks on "Cheats", they goto the folder /archive/cheats/ and index.html load, this will list ALL cheats A to Z (which is around 2000 atm or so), but imagine we have only 3 cheats, here is an example of how that should look:

    A Game (with the ID 988, so it get's linked to /archive/cheats/998.html)
    B Game (with the ID 23, so it get's linked to /archive/cheats/23.html
    Z Game (with the ID 4555, so it get's linked to /archive/cheats/4555.html)

    Now, they're listed, when someone clicks on the link to view them, it sould have the title/subject (<h2>title/subject</h2>), so that's with a header 2. Then next it should have the actual post or cheats, and then a link back to the site right at the bottom.

    The same applys with both the humor and reviews. Now, I've heard something about mod-rewrite, though I'm really not sure so I'm upto any suggestions you may have about this. All help is appreciated!


  • #2
    If all you want is that format URL then take a look at the vB3 archive and the other Archive/URL Re-writing hacks that are at which use the same format URL as you have posted (Skuzzy's archive hack uses that format for example).

    This will allow you to have one PHP script that grabs and formats the content dynamicly still, but from the end users point of view it looks like a static HTML page. Moderator
    The Sisters Three Charmed Discussion Forums


    • #3
      As NTLDR said, its alot easier to use mod_rewrite than write a script that outputs such stuff..

      Hope your using apache


      • #4
        Yep, I'm using Apache .. thanks for the replies!

        Will these be search engine friendly then?



        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.