Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Dec 2007
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    static html with php help!

    hi ! how to automatic generate a html file with php ( MYSQL database ) ? with this method rescue server and speeding load page . NOTE and EXAMPLE : add any data in mysql = generate html static page auto . thanks regards .

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    The only way to automatically launch a php page is with a cron/scheduling job which is a part of the system the site is hosted on.
    There is also what I refer to as 'poor mans cron' which is the same thing as a cron job but relies on a user to load you're pages for you. Its somewhat complex to set up so I won't go into that here. Instead, check you're server for cron jobs, chances are fairly high its supported - its quite popular now.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    New Coder
    Join Date
    Dec 2007
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts
    my server support cron job ! and my localhost in windows worked with Cron For Windows/ . i need to any script for this idea . thanks

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Oh I see.
    This really depends on what you are storing in you're database. If its complete code (like templates) than you can write a script that scans each entry in the database and iterates through the records, and using file handling you can create files and write the data to them. Look into the fopen with w+b, fwrite and fclose. Note if you have PHP5 available you can also use file_put_contents which takes care of the open, write and close for you.

    This shouldn't be too terrible of a task, you're looking at probably 20-50 lines of code. Pair it up with a cronjob (or you're windows variation) and your all done. Try some things out, read from a database first for you're records, than write data to a file. After that combine them together. Shouldn't take you too long to do.
    Come back if you have any problems with how to do specific things!
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #5
    New Coder
    Join Date
    Dec 2007
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oops !? my example : movabletype Or vbulletin ! this script generate html static auto with php or perl . way out is html page ( with out mod_rewirte apache ) How to ? Any Idea for this ?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •