Forum Moderators: coopster
so essential my preg_replace should like like
preg_replace("some regexp","javascript: someFunction('$1');",$myPage)
thanks any help would be mucho appreciated
If you want to use PHP, you will only be able to do a preg_replace if the "a" tag is in a guranteed format. Otherwise you will have to write a more complicated function to match "a" tags and then do a replace.
How are you loading the file to be parsed?
I.E.
<a href="thispage.asp"> needs to be <a href="javascript: clickLink('thispage.asp')>
but i need to make sure that <a href="http://www.whateverpage.com"> doesn't become <a href="javascript: clickLink('http://www.whateverpage.com')">
I.E. the links that are already absolute before i change them should stay as links where as the relative urls should become a javascript function