Jump to content

Some questions about iframes


Corhynia

Recommended Posts

I am thinking about converting an old website from using PHP to iframes.    http://www.rymich.com/girraween/

As it stands, the header, nav bar, content and footer are all put together by PHP.  What I am thinking of doing is making the header, nav bar and footer all one html document with an iframe for the content area (separate html files from the same domain) to be inserted.  That is, no longer use PHP.

What I am wanting to know is:

- when making the content files, do I need to include all the usual html coding such as <!doctype html>, <html>, <head> with the metas, and <body>?

- if I do this, will I need to use javascript to make the titles change for each content area change?

- I am assuming from what I've seen in the forum that I will also need to use javascript to work out the height of the incoming file to adjust the height of the iframe.

- are there any other problems people doing the same sort of thing have come across that I would need to know about?

I guess you could call me an intermediate html user. 

 

Link to comment
Share on other sites

That is not a good idea. Iframes have a terrible way of messing with the browser history among many other problems, PHP is a much better option. Why do you want to remove PHP?

To answer your questions:

  • The content in an iframe should be a complete document with a <!doctype>,<head> and <body>
  • The window title will not change when the iframe changes, so you would have to use Javascript if you want that to happen.
  • You would need Javascript if you want the iframe to be the same height as the document that it contains.

There are only very special cases where using an iframe is not a bad idea and all of them are when building Javascript applications, not websites.

Link to comment
Share on other sites

Thanks for replying Ingolme.  You have confirmed what I suspected.  Unfortunately, I don't know PHP and the person who did it for me originally is no longer able to help.  I guess I'll have a look at the W3Schools PHP tutorials to see if I can learn how to do it myself.  It's been a long time since I built the website (now I look at it, my html coding is horrible!), so I've been doing the html and CSS tutorials to refresh/update my knowledge.  They've been very good and...I guess... there's nothing bad about learning new things.  🙂 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...