Results 1 to 3 of 3

Thread: PHP Array Link Help

  1. #1
    Join Date
    Jul 2011
    Location
    Ontario, Canada
    Posts
    22
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default PHP Array Link Help

    Good day fellow coders,

    I was hoping you would be able to look over my PHP Code below and help to me out. I am trying to get the http link to open in a new blank window.

    Currently the link opens in the same window?

    Can you help me out?

    PHP Code:

    <?php

    // Each sponsor is an element of the $sponsors array:

    $sponsors = array(
        array(
    'fleming','Apply for the EVC Program today.','http://flemingcollege.ca/'),
        array(
    'rom','You belong at the ROM','http://www.rom.on.ca/'),
        array(
    'canadian_wildlife','Canadian Wildlife Federation. Celebrating 50 years.','http://www.cwf-fcf.org/en/index.html/'),
        array(
    'support','Help support Fleming College and the EVC Program.','http://flemingcollege.ca/'),
        array(
    'support','Help support Fleming College and the EVC Program.','http://flemingcollege.ca/'),
        array(
    'support','Help support Fleming College and the EVC Program.','http://flemingcollege.ca/'),
        array(
    'support','Help support Fleming College and the EVC Program.','http://flemingcollege.ca/'),
        array(
    'support','Help support Fleming College and the EVC Program.','http://flemingcollege.ca/'),
        array(
    'support','Help support Fleming College and the EVC Program.','http://flemingcollege.ca/'),
        array(
    'support','Help support Fleming College and the EVC Program.','http://flemingcollege.ca/'),
    );

    /* // Randomizing the order of sponsors:
    shuffle($sponsors); */

    ?>

    <?php
    // Looping through the array:

    foreach($sponsors as $company)
    {
        echo
    '
        <div class="sponsor" title="Click to flip">
        <div class="sponsorFlip">
        <img src="images/collaborate/'
    .$company[0].'.png" alt="More about '.$company[0].'"/>
        </div>
        
        <div class="sponsorData">
        <div class="sponsorDescription">
        '
    .$company[1].'
        <br /><br />
        <div class="sponsorURL">
        <a href="'
    .$company[2].'">'.$company[2].' </a>
        </div></div></div></div>
        '
    ;
    }
    ?>
    Any help or suggestions you can offer would be greatly greatly appreciated.

    Many thanks,
    Alan

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 517 Times in 503 Posts
    Blog Entries
    5

    Default

    PHP Code:
    '
    <a href="'
    .$company[2].'" target="_blank">


  3. The Following User Says Thank You to traq For This Useful Post:

    bornegraphics (05-07-2012)

  4. #3
    Join Date
    Jul 2011
    Location
    Ontario, Canada
    Posts
    22
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default

    Thanks a million Traq. That piece of code works perfectly!

    I knew you had to add the 'target="_blank" somewhere but everywhere I tired it just didn't work.

    Thanks again.

    Cheers,
    Alan

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
  •