PDA

View Full Version : open new window



viktor
12-26-2008, 09:21 AM
I know the basics in php and know I can use open.window function to open links in new window.

I have this code, and the links it generates open in parent window. How can I modify it to open links it generates in new window?



<?PHP
//replace the value of $url with your own link from the code generator
$url = "sample.link.com";
if($my_blogroll = @fopen("$url", "r")){
while(! feof($my_blogroll)){
$blogroll = fgets($my_blogroll, 255);
echo "$blogroll";
}
}else{
echo "ERROR: $url is currently inaccessible";
}
?>


Thanks guys,
viktor

maneetpuri
01-03-2009, 10:22 AM
Hi,

Just before

echo "$blogroll";

put this line

$blogroll = str_replace(“<a”,”<a target=_blank”,$blogroll);

This is solve your purpose.

Cheers,
~Maneet