PDA

View Full Version : Frames Inside a Table?



holmedwa04
10-27-2008, 11:48 PM
Dear All

I am creating a website using tables in HTML and have now discovered why I made my last site have the navigation on the index page and the index page only!

As I have started to add files to the site I am realising that I am having to keep adding new entries into the navigation on every page!

So the only way I can figure out of getting around this one is to use frames, whereby I use a frame to display a file called lets say: navigation.html

As the layout of the website currently uses tables I would like to keep the tables and would like to know if there is a way of inserting a frame into a cell in a table? Without any additional scrollbars. Or if there is a way of embedding a HTML file in a cell of a table?

I would be most appreciative of any help offered, as I really don't know how I am going to get around this one without making my whole site frame based which I don't want to do!

Kindest Regards Edward

rangana
10-28-2008, 01:15 AM
You can't use the frame tag. Use iframe (http://www.w3schools.com/TAGS/tag_iframe.asp) instead.

Though it might work well, note that frames are evil (in a number of ways) (http://www.html-faq.com/htmlframes/?framesareevil).

You might find to use PHP's include() (http://us.php.net/include/) useful.

Hope that helps.

holmedwa04
10-28-2008, 09:43 AM
Ok thanks for your help. Is the "frames are evil" directed at frames and frames only or at iframes as well?

If directed at frames only please can I send you the code for my site and ask you how I should use it?

And if so what is the best solution compatibility wise?

Regards Edward

rangana
10-28-2008, 10:25 AM
Ok thanks for your help. Is the "frames are evil" directed at frames and frames only or at iframes as well?


It was addressed on using both frames and iframes.



If directed at frames only please can I send you the code for my site and ask you how I should use it?

Please use the public board, so that others can help and at the same time benefit from the board member's response.



And if so what is the best solution compatibility wise?

...don't use frames. Use either AJAX or server-side scripting to include file. PHP has one (include()).

holmedwa04
10-28-2008, 05:51 PM
Ok, I have tried the php thing and that just confuses the life out of me! I tried downloading Apache software and all sorts, I just couldn't get my head around how to use it.

So I went for the iframes solution, really liking the results that I had achieved because it looked exactly like it did before and now I had just one page to change when I added a new page to my site.

I couldn't have been more wrong! Obviously because it is a frame it opens in the same frame! So I nearly went mad when I clicked a link only to find it opening in the iframe! After calming down and looking into name and target attributes I have been able to set the name of a cell in my table to "main" and get the links in the navigation to target main.

I was quite pleased with myself and thought I would tidy a few things up only to find that I have just completely messed everything up now! The navigation displays correctly and everything but as soon as I click a link on it, it opens in a new window as though the target is blank when it isn't it is quite clearly "main" which is one of the cells in the table!

I would really appreciate any help! Because quite frankly at the moment I am ready to give up altogether!

Kindest Regards

Edward

holmedwa04
10-28-2008, 08:35 PM
I have moved back to the php again and it produces the same results, it displays the page that you click for in the cell of the table that the link is in, not the main cell in the table.

Is what I am trying to do impossible? Or should I just face the fact that when I make a new page I am going to have to edit every other page on my website?

Again any help would be much appreciated.

Kindest Regards

Edward

traq
10-29-2008, 04:46 AM
I'd suggest trying Ajax. The Ajax Dynamic Content (http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm) script works well and isn't to confusing.

PHP and Apache would be a better way to go in the long run (more stable and more accessible), but it can be confusing if you try to do it yourself. Find out if your web host already supports PHP includes. If they do, then it's as simple as writing <?php include ('menu.html'); ?> wherever you want the menu.

On a side note, you should look into learning how to format/ layout your webpages using css instead of tables. It might take a bit of experimenting to figure it all out, but it's worth it.

[ edit ]: in regards to your iframe problem, try adding
target="_top" to all your menu links. I don't think a link can target a cell in a table; the "name" target is designed to target a specific frame.