php2Static

Version 1.0
http://www.bcmweb.com/scripts/php2Static/

Copyright (C) 2001 Alex Hill <alex@bcmweb.com>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

INSTRUCTIONS

Overview:
With the increase of dynamic pages on the web the standard ".html" link is slowly disappearing. php2Static will read your dynamic page URL's and create static HTML files that can be referenced by search engines or for your own use to publish files with much shorter URL names. The static HTML files will contain all images and links and properly forward back to the dynamic pages.

Requirements:
php2Static requires a web server running PHP and a MySQL Database.

Security:
php2Static has a rudimentary password system in place. However to secure the application use your servers built in authentication such as ".htaccess" files in Apache. Any application that can write and delete files on your server should be properly protected.

Installation:

  1. Extract the zip file into the directory of your choice.

  2. Edit "StaticHeader.php" and edit script variables. Minimum requirements are database information and password. By default php2Static uses a table named "staticpages", but this can be changed in the configuration.

  3. Create the necessary table in MySQL using the "static.sql" file. You can use the mysql-client for this:

    mysql <db-name> < static.sql

    or you can use phpMyAdmin <http://phpwizard.net/phpMyAdmin> to read in the dump.

  4. Point your browser to <www.your-host.com>/<your-install-dir>/index.php and create a new static file.
How To Use:
php2Static works by opening a correct URL, reading in the contents, and then writing a file onto the server. It will also replace any META Keywords and Description information with your specified entries. The File Description is only used for the application itself and does not show up in the static file.

Add a new file by filling out the form properly and submitting. This will NOT create the static page, only the database entry. The Main Menu will allow you to create all the static pages listed in the database (can be resource intensive) or individually. Editing entries will also only make database entry changes and NOT create the static file.

When adding or editing the "HTML Static Page Path" must either be a full path or the relative path to the file you want to create. As an example, if you have placed php2Static in a subdirectory on your website, ie: http://your.domain/php2Static/ the to write a file in the web server root you can enter "../filename.html". To write to another subidirectory use "../directory/filename.html".

Deleting an entry will remove the database information and also attempt to delete the file from the server. If your PHP install does not support the "unlink()" function it will be ignored.

The script assumes that all static pages will use the ".html" extension. To change this you will have to edit the "StaticPageAdd.php" file on line 72 and "StaticPageUpdate.php" file on line 33. Change:

if(!eregi("\.html$",$fileHTML))

to use your desired extension.

Download:
php2Static.zip