#native_company# #native_desc#

easy dynamic websites

By Joshua Newberry
on January 3, 2002

Version: 1.1

Type: Full Script

Category: File Management

License: GNU General Public License

Description: This code allows you to create dynamic web pages based the design for your site. This script is simple, end user friendly, and very powerful. It only takes about 10 minutes to set up, and it will integrate into any existing site.


		Thank You for Using Easy Dynamic Websites 1.0
		Please email all SUGGESTIONS to [email protected]

	If you get confused in the instructions, you can download a zip file with 
	all of the files in it that you need with simpler instructions 
	from www.jnewberry.com/easydynweb.zip


1. 	Create a folder on your web server with Read Write and Execute Permissions for 
	Group Owner and Other (this is CHMOD code 777 if you are telneting)

2.	Create a page called create.html or create.php using the code below:

<title>Add or Update Your Web Pages</title>
<div align="center">
  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="593" id="AutoNumber1">
  <font face = "Comic Sans MS">
  <td width="600" align="center" valign="top">
  <Form Action = "process.php" Method = "Post">
<font size="2" face="Comic Sans MS"><b>Type a name for your page:</b></p>
<font size="3" face="Comic Sans MS"><p>
<Input type = "text" Name = "fname" size="20" value="yourpagename.php"></p>
<font size="2" face="Comic Sans MS">
<p><b>Copy and paste the HTML code from FrontPage:</b></p>
<font size="3" face="Comic Sans MS">
<textarea name = "input" rows="15" cols="35"></textarea></p>
<p><Input Type = "submit" value="Submit" name="Submit"></font><font size="2" face="Comic Sans MS">&nbsp; </font>
<font size="3" face="Comic Sans MS">
<Input Type = "reset" value="Clear" name="Reset"></font><p>&nbsp;</td>
<p style="line-height: 150%; margin-top: 0; margin-bottom: 0" align="center">&nbsp;</p>

3.	This file and create.php Must be placed on your web server in the directory that you gave the write permissions to.

							Pay Close Attention to Step 4 and 5

4.	There are two more files that must be created and placed in your folder that you gave the write permissions to:

		1. header.php
		2. footer.php

	If you haven't created a Template for your website yet, 
	then you can create these two files and leave them blank.

	After you have Created these files, the script will work perfectly, but not to full functionality!!!
	The header and footer are the keys to making this project work.  
	This script creates a file with the name you gave it on the form, places the content of header.php at the top 
	of the page, the information that you typed in the form on the create.html page in the middle, and 
	footer.php at the bottom.

	Simply Put:
	header.php + <your data from the form> + footer.php = Your_New_Page.php

5.	You need to design a template for your site it html.
	Note: It will work much better if you create a blank table to as a placeholder 
	for where <your data from the form> will be placed. Everything above this table is header.php,
	and everything below it is footer.php

	Here is an example of how to do this:
	<title>Template Page</title>
	<h1>Welcome to my Site!!</h1>
	This text represents Your input from the form that you created in Step 2.
	Everything above this text you should copy into header.php 
	Everything below it is footer.php

6.	Since the header and footer are called each time the web pages are called, 
	any changes that you make to the header and footer are applied to ALL OF YOUR PAGES 
	making an incredibly easy to update	dynamic website!!  I hope you enjoy this code!!!

7.	It is wise to add a picture upload script to this as well.
	This is completely optional, but I often integrate Darren Beale's Upload Script found here:

	The easiest way to integrate this is to add a Javascript Button to your create.html page and make his script 
	appear in a popup window.


//This is the actual script that is called when you submit a new page.
//Define the Variables

$fp = fopen ($fname, "w+");

$noslash = explode("", $input);
$newinput = implode("", $noslash );

$header = "<? readfile( 'header.php' ); ?>";
$footer = "<? readfile( 'footer.php' ); ?>";
$congrats = "<? readfile( 'congrats.php' ); ?>";

//Printing the Congrats Message
readfile( 'header.php' );

printf( '<p align="center"><font size="5">Your Page has been successfully uploaded.
<p align="center"><font size="5"><a href = ' . ($fname) . ' >  
Click here to view the page</a></font></p>');

readfile( 'footer.php' );

//Creates the file with the appropriate information

fwrite( $fp, $header );
fwrite( $fp, $newinput );
fwrite( $fp, $footer );

fclose( $fp );