Re: urls and target=_blank

From: Date: Mon, 19 May 2003 09:39:30 +0000
Subject: Re: urls and target=_blank
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148142@lists.php.net to get a copy of this message
try preg_replace_callback() and in your funciton use strpos() or something similar to check if the link is on site or not. see this post for an idea of how to use. http://marc.theaimsgroup.com/?l=php-general&m=104662430726317&w=2 olinux --- Sebastian <sebastian@dslr.net> wrote: > Hello, I'd like to make only external links open in > a new window, but not > open in new window when its an on site link, any > easy method of doing this? > this is the custom code use for urls, just wondering > if its possible to do > this. > > $news = > preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/si", "<a > href=\\1 > target=_blank>\\2</a>", $news); > > cheers, > - Sebastian > > > __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com

« previous php.general (#148142) next »