Page 1 of 1

target=blank

Posted: Sun Aug 03, 2003 10:39 pm
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

Posted: Sun Aug 03, 2003 11:01 pm
by m3rajk
umm... i need to see more.

if you wanna put it in the code directly, : target="_blank"

Posted: Sun Aug 03, 2003 11:02 pm
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>';

Posted: Sun Aug 03, 2003 11:33 pm
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";

Posted: Mon Aug 04, 2003 1:19 am
by Tubbietoeter
you should do an extra array and put the targets in it.

Posted: Mon Aug 04, 2003 3:38 am
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

Posted: Mon Aug 04, 2003 12:07 pm
by norm188
Ok,

Thank you very very much

Norm