slapme Posted March 2, 2008 Share Posted March 2, 2008 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); } } Link to comment https://forums.phpfreaks.com/topic/93936-adding-more-files-to-a-folder-using-this-script/ Share on other sites More sharing options...
trq Posted March 2, 2008 Share Posted March 2, 2008 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); } } ?> Link to comment https://forums.phpfreaks.com/topic/93936-adding-more-files-to-a-folder-using-this-script/#findComment-481365 Share on other sites More sharing options...
slapme Posted March 2, 2008 Author Share Posted March 2, 2008 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 Link to comment https://forums.phpfreaks.com/topic/93936-adding-more-files-to-a-folder-using-this-script/#findComment-481443 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.