Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Nov 2004
    Location
    Perth, Western Australia
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    header(location) ?target

    Hi all,

    I'm a bit of a newbie at php and web building

    Is it at all possible using the header("Location redirect to target a frame on my site, specifically the main frame.

    Basically I created several html pages in dreamweaver ( r1.html, r2.html, r3.html....) each page resides in its own /dir with its own index.php page as below:-

    PHP Code:
    <?php
    //Date & Time redirection

    //Retrieve the current date/time.
    $timenow=strtotime("NOW");

    // Set the r1 cutoff date & time.
    $r1_end=strtotime"2007-04-05 17:35" );

    //If the current date and time is before the r1 cutoff date & time. 
        
    if ($timenow <= $r1_end){

    //Redirect to r1.html page.
            
    header("Location:http://mysite.com/r1/r1.html"); 

    }

    //Else if  the current date and time is after the r1 cutoff date & time. 
        
    elseif ($timenow >= $r1_end){

    //Redirect to "sorry you missed it" page.
            
    header("Location:http://mysite.com/sorry.html"); 
    }
        
    ?>
    Each of these pages ( r1.html, r2.html, r3.html.....etc.) has a dropdown menu/list box on it which has a http:// link to the index.php for each /dir.

    Hope I'm making sense so far.

    Now the problem I'm having is, the r1.html page opens up in the main frame no problem, but if I use its dropdown menu to select r2.html or any other page, they all open up outside of the frame in the whole window and I have to use the browser back button to get back to the site.

    I have tried using the:-

    <head>
    <base target="main">
    </head>

    on each .html page but it doesn't work.

    I'm sure its something really basic, but for the life of me I can't figure it out.

    Any help is much appreciated

    cheers

    chip
    Last edited by chippy; 01-19-2007 at 02:57 PM. Reason: used code tag

  • #2
    Regular Coder
    Join Date
    Jan 2007
    Posts
    213
    Thanks
    0
    Thanked 0 Times in 0 Posts
    the header("Location: "); part of php does not accept targets, however an alternative way of doing this is to not use the header command at all (really it should only be used for redirecting not for what you want to do) so what I would do is use an include instead, thus solving the problem completly
    Matthew Bagley
    Paramiliar Design Studios
    Website Design | Website Development | Search Engine Optimisation (SEO)

  • #3
    New Coder
    Join Date
    Nov 2004
    Location
    Perth, Western Australia
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by neomaximus2k View Post
    I would do is use an include instead, thus solving the problem completly
    Hi neomaximus2k, thanks for your reply.

    Is this what you mean?
    PHP Code:
    //If the current date and time is before the r1 cutoff date & time. 
        
    if ($timenow <= $r1_end){

    //Redirect to r1.html page.
            
    include("../r1/r1.html"); 

    }

    //Else if  the current date and time is after the r1 cutoff date & time. 
        
    elseif ($timenow >= $r1_end){

    //Redirect to "sorry you missed it" page.
            
    include("../sorry.html"); 


  • #4
    Regular Coder
    Join Date
    Jan 2007
    Posts
    213
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by chippy View Post
    Hi neomaximus2k, thanks for your reply.

    Is this what you mean?
    PHP Code:
    //If the current date and time is before the r1 cutoff date & time. 
        
    if ($timenow <= $r1_end){

    //Redirect to r1.html page.
            
    include("../r1/r1.html"); 

    }

    //Else if  the current date and time is after the r1 cutoff date & time. 
        
    elseif ($timenow >= $r1_end){

    //Redirect to "sorry you missed it" page.
            
    include("../sorry.html"); 

    Yep thats basicly it, personally i dont like using the "../" part in includes has caused me nothing but grief so I tend to set a variable called $abspath to the absolute path to the root directory of the website, that way i dont have to worry about includes.
    Matthew Bagley
    Paramiliar Design Studios
    Website Design | Website Development | Search Engine Optimisation (SEO)

  • #5
    New Coder
    Join Date
    Nov 2004
    Location
    Perth, Western Australia
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by neomaximus2k View Post
    Yep thats basicly it, personally i dont like using the "../" part in includes has caused me nothing but grief so I tend to set a variable called $abspath to the absolute path to the root directory of the website, that way i dont have to worry about includes.
    Thanks neomaximus2k, I will definately try your suggestion and see how I get on, I will post back here with the results.

  • #6
    Regular Coder
    Join Date
    Jan 2007
    Posts
    213
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by chippy View Post
    Thanks neomaximus2k, I will definately try your suggestion and see how I get on, I will post back here with the results.
    This is part of the config.inc.php file i tend to use with my projects

    Code:
    	$companyname = "Paramiliar Design Studios";
    	$websiteurl = "http://".$_SERVER['HTTP_HOST']."/";
    	$secureurl = "https://".$_SERVER['HTTP_HOST']."/";
    	$abspath = "/home/sites/paramiliar.net/public_html";
    	$adminpath = $abspath."/theadmin";
    As you can see i hard code the absolute path in the $abspath variable and the others are self explanatory
    Matthew Bagley
    Paramiliar Design Studios
    Website Design | Website Development | Search Engine Optimisation (SEO)


  •  

    Posting Permissions

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