Jump to content


Photo

IFRAME question


  • Please log in to reply
7 replies to this topic

#1 aviatorisu

aviatorisu
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 29 September 2006 - 12:42 AM

I'm not quite sure how to ask this, but I'll give it my best.

Located on the front page of my homepage is an IFRAME.  When the page initally loads up, it displays a default page welcoming people.  Based on what button a user selects, a new section page is generated within the IFRAME.  Is there a way to load the page (through a link for example) to force the home page to load with one of the section pages instead of the default welcome?  This way, users can go directly to the start of one section without having to read the welcome over and over again.

Thanks,

~Z~

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 29 September 2006 - 02:56 AM

I'm not quite sure how to answer, though the answer is probably yes... when you want to change the IFRAME src?
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 aviatorisu

aviatorisu
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 29 September 2006 - 03:01 AM

Not so much change the default source...think of it this way:

I have a menu bar that, ideally, I'd like to be able to reload the homepage, but to a specific frame that perhaps the user has already visited.  It's such a pain for them to have to go through 1 or 2 other frames to get back to the one they were using previously.  Does that make more sense?  I guess simplified, is there a way to directly target (through the use of a link) a frame that perhaps would take 1 or 2 steps to navigate to normally?

~Z~

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 29 September 2006 - 03:03 AM

Again, I'm not really sure what you're getting at... the TARGET attribute generally work with HREFs.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#5 aviatorisu

aviatorisu
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 29 September 2006 - 05:12 AM

Okay, perhaps a layout description would help.

1) The user starts on the home page, which has an IFRAME within it.
2) The user can make click a link which will change the page within the IFRAME, welcoming him to the section.
3) The new page within the IFRAME has a link within it that opens a search form within the IFRAME.
4) When the search is run, the PARENT becomes the target and the whole page changes to display results.

The question is, I would like to know if it is possible to place a link on the results page in step 4 to take the user to where he already is in step 3.  Does that make more sense?

Thanks,

~Z~

#6 FrOzeN

FrOzeN
  • Members
  • PipPipPip
  • Advanced Member
  • 70 posts

Posted 29 September 2006 - 08:53 AM

Yes, it's possible.

This example may shed a bit of light to give you the gist of it:

index.html
<html>
<body>

This is my home page.<br />
<a href="page1.html" target="frame1">Page 1</a> | <a href="page2.html" target="frame1">Page 2</a><br /><br />

<iframe name="frame1" width="500" height="500" src="page1.html">
You browser doesn't support iFrames!
</iframe>

</body>
</html>

page1.html:
<html>
<body>

This is page 1!<br />
- <a href="http://www.google.com/" target="_parent">Go to google!</a> -

</body>
</html>

page2.html:
<html>
<body>

Your now on page 2!<br />
- <a href="http://www.yahoo.com/" target="_parent">Visit yahoo!</a> -

</body>
</html>

Also, you could add <base target="frame1" /> in the <head> section and it will make all links default to that frame.

From w3schools, the target attributes are:

    *  _blank - all the links will open in new windows
    * _self - all the links will open in the same frame they where clicked
    * _parent - all the links will open in the parent frameset
    * _top - all the links will open in the full body of the window



#7 aviatorisu

aviatorisu
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 29 September 2006 - 11:01 PM

Okay, I'm not sure I am still being clear, I hate when that happens, lol.  Please proceed to the following site for the example of what I am talking about:

http://www.aviationhistoryonline.com

Now, when this homepage loads, you will see where the IFRAME is.  Click on the AIRCRAFT button to the left.  This will load a welcome page into the IFRAME with a link at the button.  Click the 'search' link to load a form into the IFRAME, and run a quick search.  This has now reloaded the entire page, and is now displaying all the results from the search.  Now, is it possible to have a link on this results page that will take you back to the home page, but with the search form loaded into the IFRAME?

~Z~

#8 FrOzeN

FrOzeN
  • Members
  • PipPipPip
  • Advanced Member
  • 70 posts

Posted 30 September 2006 - 01:53 PM

Yes, though the homepage would need to know that it has to show the search iframe. This would probably be best done by having a GET statement on the homepage read with php.

Maybe have the link on that results page as "index.php&page=search", then on index.php inside the src iframe attribute have src="<?php if ($_GET['page'] == "search") { echo "search.php"; } else { echo "default.php"; }?>".




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users