|
[x]
Posted via EE Mobile
|
|
| Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
|
|
|
|
Asked by ApOG in PHP Scripting Language
I need some help here:
Suppose I have this string:
$string = <p>Some text <a href="
http://www.mydomain.com/436.php">link to my domain</a> some other text <a href="
http://www.otherdomain.com">li
nk to other domain</a>.
I need a function that adds target=_blank to links outside my domain, so they open in new windows. But if the link contains "
www.mydomain.com" they function should NOT add the target=_blank.
This will be used for a custom blog where posters add any links and the script saves the output into a DB. This function should change the target of the link if it goes outside "
www.mydomain.com".
Thanks!
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625