Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

website redirect system needed to solve iframe problem

Options
  • 09-08-2005 9:32am
    #1
    Registered Users Posts: 1,653 ✭✭✭


    My website uses iframes to load a content page into a framset.

    The directory structure looks a little like this:

    index.php (contains frameset)
    /photos/index.php (loads into framset)
    /contact/indexc.php (loads into framset)
    etc

    My site nav loads the content into the framset using the target tag. No worries there.

    My problem arises when someone loads www.MYSITE.com/photos/ - just the content of the photo's page gets loaded and I loose the outside framset with navigation etc.

    Now, I guess I can fix this by redirecting all requests to /photos/ to /index.php?page=photos and tweaking /index.php to look for the "page" parameter and populate the contents iframe dynamically.

    Three questions. Assuming I can't redesign the site, and I'm stuck with iframes:

    1). Is the above approach the easiest and best way to solve my problem
    2). How do I set up the redirects (I'm using Apache - use httpd.conf ? How ?). I can do the parameter checking and iframe population myself.
    3). If I needed to capture all other possible (and unknown) parameters to /photos/ eg: /photos/?page=1&pix=all&1=2&3=4 etc, how can I implement this ?

    Thanks in advance for your help


Comments

  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    rename the files in photos and contact from index to say photo.php and contact.php
    place an index file in each.
    index.php:

    <?php header("location: http://www.mysite.com"); ?>
    <HTML>
    <TITLE>Redirection</TITLE>
    <BODY>
    </BODY>
    </HTML>

    place that file as index in both folders and it will redirect to where you specify in the header


  • Registered Users Posts: 1,653 ✭✭✭m_stan


    ok that works perfectly except for one thing - if I want to pass parameters to the /photos/photo.php I cannot capture these in /photos/index.php since I'm rediecting right away.

    Am I correct in this, and is there a way to capture any possible parameters and pass this back to /index.php ?

    Many thanks. It's the simple solutions that always get you. I couldn't see the wood for the trees ! :)


  • Registered Users Posts: 1,653 ✭✭✭m_stan


    I was incorrect in the above. I can check for any parameters as normal. As below.
    <?php
    	$g = $_REQUEST['g'];
    	$p = $_REQUEST['p'];
    
    header("location: /?page=photos&g=".$g."&p=".$p);
    ?>
    <HTML>
    <TITLE>Redirection</TITLE>
    <BODY>
    </BODY>
    </HTML>
    

    All works perfectly now. Thanks for helping me see the error in my ways.

    btw - I still have frames. Just used them to make the site redesign so much easier (change the css of the old pages, and pull the existing pages into a newly designed frameset).

    Here's my hard work for anyone that's interested. www.ragorder.com (still lots of firefox css cleaning up to do !)


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    Well done :)


  • Closed Accounts Posts: 519 ✭✭✭smeggle


    nice site but.... em Why do you need Frames?


  • Advertisement
  • Registered Users Posts: 1,653 ✭✭✭m_stan


    thanks.

    I needed freams becuase I had an existing site that needed a redesign. To make things easier (ie: avoid starting all over again), I implemented frames to load the exdisting pages into the new frameset. That way, all I needed to do was update the CSS that the site was using and design a framset around the content. This made it a much simpler redesign, though now I have to live with the downsides of frames.


  • Registered Users Posts: 2,157 ✭✭✭Serbian


    There's a slight problem with the page there. It scrolls for roughly 8000 pixels after the bottom of the page :p. Here's the culprit:
    <iframe name="bodycontent" src="home.html" height="[b]8000[/b]" width="571" frameborder="0"></iframe>
    


  • Registered Users Posts: 1,653 ✭✭✭m_stan


    thanks. there's some reason I did this to workaround another frame problem I had. can't remember, and it doesn't bother me enough to fix it :D maybe one day when I have too much time :D


Advertisement