Results 1 to 2 of 2

Thread: Href Target

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    266

    Question Href Target

    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.

    PHP Code:
    <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 Code:
    <?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 ?
    Last edited by systech44; Jan 4th, 2007 at 01:24 AM.

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Href Target

    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 Code:
    <?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(0count($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...
    Last edited by kows; Jan 4th, 2007 at 02:05 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width