target=blank

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
norm188
Forum Newbie
Posts: 8
Joined: Sun Mar 23, 2003 10:14 pm

target=blank

Post by norm188 »

Hi,

I'm using this in a small php script:

$url[1]="http://www.domain.com";

I would like to add target=blank

I tried several ways but could not get it to work.

Does someone know how i could get it done?

Thanks
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

umm... i need to see more.

if you wanna put it in the code directly, : target="_blank"
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Post by AVATAr »

you have to use the "blank" in the "<a href" like this

$url[1]="http://www.domain.com";
echo '<a href="'.$url[1].'" target=_blank>url</a>';
norm188
Forum Newbie
Posts: 8
Joined: Sun Mar 23, 2003 10:14 pm

Post by norm188 »

function img() {

//#### CHANGE THESE VARS TO SUIT ####
//#### START OF CUSTOMISATION ####

$adfile="img.txt";

$ad[1]="ads/img1.jpg";
$ad[]="ads/img2.jpg";

$url[1]="http://www.domain.com";
$url[]="http://www.domain.com";

$alt[1]="";
$alt[]="";

//#### END OF CUSTOMISATION ####
//#### DO NOT ALTER CODE BELOW ####

$addata=file($adfile);
$lastshown=str_replace("\n","",$lastshown);
$lastshown=str_replace("\r","",$lastshown);
$lastshown=$addata[1];
$adtotal=count($ad);

$adtoshow=1;
if($lastshown<$adtotal) {
$adtoshow=$lastshown+1;
}

//update, implode and write to file
$addata[0]="Last ad Shown - Ad Rote8\n";
$addata[1]=$adtoshow."\n";
$text=implode("",$addata);
$fp=fopen($adfile,"w");
fwrite($fp,$text);
fclose($fp);

$html="<a href='$url[$adtoshow]' target='_top'>";
$html.="<img src='$ad[$adtoshow]' alt='$alt[$adtoshow]' border=0>";
$html.="</a>";
echo $html;

return;

}


I would like to ad target ="blank"

$url[1]="http://www.domain.com";

and galleryimg="no"

$ad[1]="ads/img1.jpg";
Tubbietoeter
Forum Contributor
Posts: 149
Joined: Fri Mar 14, 2003 2:41 am
Location: Germany

Post by Tubbietoeter »

you should do an extra array and put the targets in it.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

If you want all links to have this attribute then simply change:

Code: Select all

$html="<a href='$url[$adtoshow]' target='_top'>";
to

Code: Select all

$html="<a href='$url[$adtoshow]' target='_blank'>";
Mac
norm188
Forum Newbie
Posts: 8
Joined: Sun Mar 23, 2003 10:14 pm

Post by norm188 »

Ok,

Thank you very very much

Norm
Post Reply