PDA

Click to See Complete Forum and Search --> : Href Target


systech44
Jan 4th, 2007, 12:21 AM
Hi,

I have a problem to display a .php page in a frame. The following is the code of mine. Please point out error because of which it is not displaying in the frame, but in a separate window.


<html>
<!-- main.php -->
<head>
<title>WERLIVE</title>
</head>

<frameset rows="120,*" framespacing="0" border="0" frameborder="0">
<frame name="header" scrolling="no" src="banner.php">
<frame name="main" scrolling="auto" src="display.php">
<noframes>

<body>

</body>

</noframes>
</frameset>

</html>




<?php

//banner.php

$banner=array(
0=>"1_Mysticboard_horos_728_90.jpg",
1=>"2_Mysticboard_psych_728_90.jpg",
2=>"3_Mysticboard_tarot_728_90.jpg"
);

$link=array(
0=>"http://weRlive.com/wmaster.asp?WID=124176811875&linkid=1039&promotioncode=MBast&gotopage=hostlist.asp?cat=2&fatherid=2",
1=>"http://weRlive.com/wmaster.asp?WID=124176811875&linkid=1039&promotioncode=MBpsy&gotopage=hostlist.asp?cat=2&fatherid=2",
2=>"http://weRlive.com/wmaster.asp?WID=124176811875&linkid=1039&promotioncode=MBtar&gotopage=hostlist.asp?cat=2&fatherid=2"
);

$hyperlink="";

shuffle($banner);

if($banner[0]=="1_Mysticboard_horos_728_90.jpg")
{
$hyperlink="http://weRlive.com/wmaster.asp?WID=124176811875&linkid=1039&promotioncode=MBast&gotopage=hostlist.asp?cat=2&fatherid=2";
}
elseif($banner[0]=="2_Mysticboard_psych_728_90.jpg")
{
$hyperlink="http://weRlive.com/wmaster.asp?WID=124176811875&linkid=1039&promotioncode=MBpsy&gotopage=hostlist.asp?cat=2&fatherid=2";
}
elseif($banner[0]=="3_Mysticboard_tarot_728_90.jpg")
{
$hyperlink="http://weRlive.com/wmaster.asp?WID=124176811875&linkid=1039&promotioncode=MBtar&gotopage=hostlist.asp?cat=2&fatherid=2";
}

//for($i=0;$i<=count($banner);$i++)
//{
// print $banner[$i]."<br>";
//}

?>

<html>

<head>
<title>WERLIVE</title>
</head>

<body>
<center>

<a href="<?php echo $hyperlink; ?>" target="main"><?php echo "<img src='/$banner[0]'>"; ?></a>

</center>
</body>

</html>



Thank you in advance.

By the way, can you please tell me what is the string to post PHP codes with color syntax in VBForums ?

kows
Jan 4th, 2007, 12:55 AM
you already used the right tag to post PHP syntax code blocks.

otherwise, you're using the target attribute correctly and I see no reason why the page shouldn't open in the "main" frame.

also, if you're trying to randomly pick one of your $banner items (because I see you're using shuffle()), I would suggest you do it a different way because currently, your code doesn't make a lot of sense. This would be better:
<?php
$banner=array(
0=>"1_Mysticboard_horos_728_90.jpg",
1=>"2_Mysticboard_psych_728_90.jpg",
2=>"3_Mysticboard_tarot_728_90.jpg"
);

$link=array(
0=>"http://weRlive.com/wmaster.asp?WID=124176811875&linkid=1039&promotioncode=MBast&gotopage=hostlist.asp?cat=2&fatherid=2",
1=>"http://weRlive.com/wmaster.asp?WID=124176811875&linkid=1039&promotioncode=MBpsy&gotopage=hostlist.asp?cat=2&fatherid=2",
2=>"http://weRlive.com/wmaster.asp?WID=124176811875&linkid=1039&promotioncode=MBtar&gotopage=hostlist.asp?cat=2&fatherid=2"
);
$i = rand(0, count($banner) - 1);
?>
<a href="<?php echo $link[$i]; ?>" target="main"><img src="./<?php echo $banner[$i]; ?>" /></a><br />
if your link still opens in a new window, I would make sure your frame page is displaying the right code (right click -> view source). also, I don't know where the <noframe> tags are supposed to be, but since you're not doing anything within them anyway, try getting rid of them? I don't think that will help anything, but yeah...