Have a "challenge" for you guys...
*This is not homework, an assignment, etc.. this is to help me complete a task that would otherwise take forever and curious if someone could whip out a quick solution*
I have 202 .html files and at the beginning of each file, I need to add a chunk of php code. I could make this myself, but to be honest, it would take me forever and I might as well just manually edit them lol...
All the .html files are in one folder.
Majority of the files begin with this line:
I would like to replace that line with:Code:<?php require_once('Connections/connCJ.php'); ?>
If it does not find that line, then nothing is changed on the file. This is important! I can not just simple add that line of text to the beginning of every file, it HAS to find that line before it adds anything.Code:<?php include('mobile_device_detect.php'); mobile_device_detect('http://www.campjellystone.mobi/','http://www.campjellystone.mobi/','http://www.campjellystone.mobi/','http://www.campjellystone.mobi/','http://www.campjellystone.mobi/','http://www.campjellystone.mobi/','http://www.campjellystone.mobi/',false); ?><?php require_once('Connections/connCJ.php'); ?>
Can someone knock something out that will do this?
Note: Please don't explain to me how it is done. I KNOW how it can be done, I just think that someone on here could knock it MUCh faster than I could and it would save me a LOT of time.
Thanks!
EDIT: one other thing that would be VERY cool, is if it could add the files that are not edited to a listbox or an outputted text file.






Reply With Quote