Jump to content

Adding More files to a folder Using this script


slapme

Recommended Posts

 

 

Below is a script that automatically adds a index.html file to a newly created folder.  What I would like to do is also add an inde.php file and others.  So what/where would I add to the script to have this happen? forgive the noob

Thanks

Slappy

 

 

		}
}
/**
 * Create default index.html file
 *
 * @param string path
 */
function putIndexHTML ($path) {
	if !is_file ($path . '/index.html')) {
		$handle=fopen ($path . '/index.html',"w+");
		fwrite ($handle,"<html><body bgcolor='#FFFFFF'></body></html>");
		fclose ($handle);
	}
}

Kinda defeats the purpose of a dynamic website but hey.....

 

<?php

function putIndexHTML ($path) {
	if !is_file ($path . '/index.html')) {
		$handle=fopen ($path . '/index.html',"w+");
		fwrite ($handle,"<html><body bgcolor='#FFFFFF'></body></html>");
		fclose ($handle);
                                                $handle=fopen ($path . '/index.php',"w+");
		fwrite ($handle,"<html><body bgcolor='#FFFFFF'></body></html>");
		fclose ($handle);
	}
}
?>

Im sorry I did not make myself clear in my first post.  I meant to say that I wanted to COPY some index.php and other files to the same place the index.html file is going.  The the advice Thorpe gave did work, but all it created was a blank php file, sorry for the confusion

Slappy

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.