External links through php file target=_blank + nofollow

Discussion in 'PHP' started by fadetoblack22, Dec 2, 2008.

  1. #1
    I have my external links on my site in a php file which works like this:

    The link on my site is e.g. /links.php?id=google

    and it links to a file called links.php with my links in it. "google" is the id and it follows it to the link and goes to the site.

    <?php
    $path = array(
    'google' => 'http://www.google.com',
    'yahoo'=> 'http://www.yahoo.com');
    if (array_key_exists($_GET['id'], $path)) header('Location: ' . $path[$_GET['id']]);
    ?>
    Code (markup):
    I need someone to help me put some html into the php code that:

    1) makes the link open in a new window - target=_blank
    2) makes the link nofollow.

    The html has to be in the links.php file rather than the link, so either after 'google' => 'http://www.google.com', or in the if statment.

    I have an idea that the nofollow can be put in metatags, but I am not confident it will work and have no way to test it. I need some guidance.

    thanks.
     
    fadetoblack22, Dec 2, 2008 IP