1

Topic: php code

What do I need to change in the following php code to add the html equivalent of target="_blank"?

$full_url = str_replace(array(' ', '\'', '`', '"'), array('%20', '', '', ''), $url);
    if (strpos($url, 'www.') === 0)
        $full_url = 'http://'.$full_url;

    $link = ($link == '' || $link == $url) ? ((strlen($url) > 55) ? substr($url, 0 , 39).' … '.substr($url, -10) : $url) : stripslashes($link);

    return '<a href="'.$full_url.'">'.$link.'</a>';

Thank you

Last edited by DesperateSailors (2011-12-07 15:19:13)

2

Re: php code

change:

    return '<a href="'.$full_url.'">'.$link.'</a>';

to:

    return '<a href="'.$full_url.'" target="_blank">'.$link.'</a>';

3

Re: php code

thanks misulicus glad we have a coder here answer this sort of questions wink

Give the world the best you have, and the best will come to you.
Tutorials and Mods for VldPersonals  Add CometChat to your vldPersonals site

4

Re: php code

Thanks misulicus, that works perfectly

Anyone else wanting to make their click-able links open in a new tab, the code to change is in includes/fns/fns.parser.php and is on line 132