Log in

View Full Version : PHP Array Link Help



bornegraphics
05-04-2012, 04:48 PM
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

// 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

traq
05-04-2012, 07:42 PM
'
<a href="'.$company[2].'" target="_blank">
'

bornegraphics
05-07-2012, 03:30 PM
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