Results 1 to 2 of 2

Thread: open new window

  1. #1
    Join Date
    Dec 2004
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question open new window

    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?

    Code:
    <?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

  2. #2
    Join Date
    Sep 2008
    Posts
    56
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Default Re:- Open new window

    Hi,

    Just before

    echo "$blogroll";

    put this line

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

    This is solve your purpose.

    Cheers,
    ~Maneet

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •