i have more than 3000 html files i want to add a footer to all files if i edit every file to add <? include"footer.html"; ?> Code (markup): it will take more than 10 days how could i add afooter to all files and in the same time getting title and file name displayed. i mean "without changing files names or titles" say if file title is digitalpoint after adding footer the file title will be digitalpoint and if file name is digitalpoint.html after adding footer the url will be "mysite.com/digitalpoint.html"
Ok, make sure you create backups before you do this. Don't do this unless you feel comfortable doing it and have an understanding of the command line!!!! I've not tested this, but it should work. 1. create a temp directory: mkdir temp_directory; PHP: 2. move to the temp_directory: cd temp_directory; PHP: 3. copy your files to this directory for the edits: cp -R /path/to/live/files .; PHP: 4. append the php include to each file in the directory: for x in `ls`; do echo "<?PHP include 'footer.html'; ?>" >> $x; done; PHP: 5. copy the files over to production: cp -fr * /path/to/live/files; PHP: That should at least add the footer to each file. I didn't understand the second part of what you are trying to do. There might be an easier way to append the code to each file, but this is how I would do it I think.
you can use any find-replace tool to replace </html> (the end tag for all your html files) with include + </html>. If you want I can program this for you in Java and run it over all your files for 5$
3K files is too many to open in a text editor. He's using Linux so the commands I posted should do the job completely in just a few seconds. The command line is very powerful, no need to write java code.
thanks solidphp but my webhost prevent me from making any commands could you give me another way i understand some steps : making temp_directory folder and uploading the files to it. what is next ? thanks again
Look at my signature if you want a tolerant host. I work with people in a one on one basis and can help with situations like this. Anyway, without that kind of access on the server level. I would suggest doing your work offline on a local PC. Maybe download a bootable CD here: http://www.ubuntu.com/products/GetUbuntu/download?action=show&redirect=download You can download that, burn it to CD, keep it in your drive and reboot your PC. You can then FTP in the 3K files, make the changes locally and then FTP the files back. Sounds like a big hassle, but I don't think there's an "quick/easy" solution with the amount of data at hand. Let me know if I can help.
Install Textpad and write an easy macro to do this. Then Open 200 files(drag-drop ) at a time(to be safe of not hanging the PC) run the macro to change it. Then save all and upload. Let me know, if you need help in this.
If you have a windows system, you can try with dreamweaver where you have an option for find and replace in entire directory... I am not sure what will heppen when you try with 3K files at a time but it works for me when i am editing some 100's at a time... cheers mate
is there any option in dreamweaver or any another programme that enable me to search for a word or tag "</body>" and add after it my wanted code. <? include"footer.html"; ?> Code (markup): i mean - programme that have option "find in files source code and add after"
That's what he was telling you in the post above. Do a find and replace. find </body> and replace it with "your footer info" </body>
I doubt there's an "add after" feature in any editor but you achieve the same thing with find/replace. Find "</body>" replace with "<?php include 'footer.html'; ?></body>" You could do this with mod_rewrite and a php script - it wouldn't actually edit the files but it would have the same effect. RewriteCond %{REQUEST_URI} -f RewriteRule (*.)\.html index.php?file=$1 [NC,L] Code (markup): Intercept every request, check the file exists and rewrite to the index.php script: <?php include $_GET['file']; include 'footer.html'; ?> PHP: Obviously it'd be a bit better written than that but you get the idea.
just open any file in a folder press ctrl+f (control and f key) .. you will get a window .. in search text box add </body> and in replacement text add <? include ("footer.html") ?> </body> then on top of that windown (left side) you will find a drop down with some options like CURRENT DOCUMENT, ALL OPEN FIELS ...etc Select option of FOLDER ... and then simple click on replace all (on top tight side) I hope i have cleared all of your doubts..