0

My folder contains about 500 files (html). Each files contain this script

<script type="text/javascript"><!--
google_ad_client = "??????";
/* unit1 */
google_ad_slot = "??????";
google_ad_width = 120;
google_ad_height = 90;
//-->
</script>

I want to replace above code with this

<script type="text/javascript" src="/wp-content/themes/twentyfourteen/open.js"></script>

I used this code >>is good

http://pastebin.com/wuWupgBg

This find and replace in php only but no find and replace in html. Can anyone make it find and replace in html files?

2 Answers 2

1

replace this code:

if( is_file( $path ) && substr($path, -3)=='php' && substr($path, -17) != 'ChangePHPText.php'){

with:

if( is_file( $path ) && substr($path, -4)=='html' && substr($path, -17) != 'ChangePHPText.php'){
Sign up to request clarification or add additional context in comments.

Comments

0

Not really what we do here, but I would think you would just change line 17:

if( is_file( $path ) && substr($path, -3)=='php' && substr($path, -17) != 'ChangePHPText.php'){

to

if( is_file( $path ) && substr($path, -4)=='html' && substr($path, -17) != 'ChangePHPText.php'){

Though honestly, if you're doing that much text change, you may find a text editor that does string replacement in files to be much faster.

1 Comment

Wow, thank you very much (John C). you are right. i changed ($path, -3)=='php' to ($path, -3)=='html' but i didn't change ($path, -3) to ($path, -4), for this reason my error. thank you again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.