January 30th, 2009, 04:46 AM
Join Date: Aug 2003
Time spent in forums: 2 Days 7 h 12 m 32 sec
Reputation Power: 14
Identify external links in a string and add text to them
Guys and girls,
I'm using PHP. I usually like to work these things out myself but I'm totally stuck.
Taking a clump of text e.g. from a CMS entry, I want to check all the links in the text and for those that do not contain
in the URL path I want to add the text along the lines
"(this link will take you away from this section)"
to the text in the anchor tag, for all links in the text provided.
<a href="some/other/place">my link</a>
<a href="some/other/place">my link (this link will take you away from this section)</a>
I got as far as this for the expression:
but couldn't even get that to work...
Really appreciate some help with this. Many thanks.
Time isn't wasted if you're wasted all the time