Google Answers Logo
View Question
 
Q: Web Design - Linking to a cell in a table ( No Answer,   15 Comments )
Question  
Subject: Web Design - Linking to a cell in a table
Category: Computers > Programming
Asked by: gojira248-ga
List Price: $10.00
Posted: 19 Apr 2005 23:45 PDT
Expires: 22 Apr 2005 01:46 PDT
Question ID: 511682
I am trying to design a pretty simple webpage using a table layout. 
There is a top bar, a navigation bar on the left, and a body area for
text to be displayed (according to which button is clicked on the
left).  I know how to do this with frames, but frames are not great,
so I want to do this with a table.

How do I setup the link, so that when a button is click on the left
navigation bar (in the left column) the corresponding text appears in
the body cell.  I want it to work exactly like in a frame layout, so
the top and left don't have to reload everytime.

I am using Adobe GoLive CS.  Please provide clear instructions on how
to do this, especially if something like java scrip is required. 
Thanks very much.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Web Design - Linking to a cell in a table
From: kalpanaprasad-ga on 20 Apr 2005 01:39 PDT
 
Hi there

There is an eligent way of doing it using php. I dont know if you are
just interested in using tables or php is ok with you. Here goes the
solution.

Create a file say something like "menu.inc" for example and have a
code with the menu items in it like.

<html><body>
<a href="page1.php">page1</a> -
<a href="page2.php">page2</a> -
<a href="page3.php">page3</a> -
<a href="page4.php">page4</a>
</body>
</html>

and then have in each of your php files.
for example page1.

<?php include("menu.inc"); ?>
<p>I want this in page1</p>
</body>
</html>

and do create similar ones for all pages.

Hope it helps.

cheers,
prasad..
Subject: Re: Web Design - Linking to a cell in a table
From: kalpanaprasad-ga on 20 Apr 2005 01:40 PDT
 
sorry missed the link, here is the link.

http://www.tizag.com/phpT/include.php

cheers,
prasad.
Subject: Re: Web Design - Linking to a cell in a table
From: gojira248-ga on 20 Apr 2005 07:49 PDT
 
Hi Prasad, thanks very much for your help. I have two other questions:

1. How do I setup the links so that the target, say the contactus
page, opens up in a cell on the index.php page?

2. I see that I can have my links (about us, contact us, etc) in this
case in html, is there anyway to setup the left nav bar to be in html
as well and then just use php to do the grunt work (prevent need for
reloading and such)?

I want to have the left nav bar, which is made with rollovers and
stuff, open text pages in the cell next to it (the body of the page). 
Thanks very much in advance for you help.
Subject: Re: Web Design - Linking to a cell in a table
From: gojira248-ga on 20 Apr 2005 08:22 PDT
 
Hi, I figured out how to answer question #2, and the left nav bar is
now working fine, but the pages they target open in a ne page.  How do
I have them target the cell to the right, and display and html page in
that cell?
Subject: Re: Web Design - Linking to a cell in a table
From: willcodeforfood-ga on 20 Apr 2005 08:43 PDT
 
Frames or iframes are the only way to accomplish what you are asking. 
There isn't any script/DHTML/HTML way to reload just part of your
page's content without also reloading the top and left nav.  Even the
solution suggested by kalpanaprasad is going to reload the entire
page, navigation and all.  What is it about frames that is not
acceptable to you?  I ask because when frames are done right, they can
be made to flow together seamlessly and can even fool an experienced
user into thinking they are seeing a single page.
Subject: Re: Web Design - Linking to a cell in a table
From: gojira248-ga on 20 Apr 2005 09:41 PDT
 
I have been told that frames should be avoided if possible because
they can't be properly indexed by search engines, which may only pic
up the body of a page, and not the navigation bar.  Is this the case?

But does using iframes avoid this problem?  If so, do you know any
good links that will help me incorporate this into my page.  Thanks.
Subject: Re: Web Design - Linking to a cell in a table
From: gojira248-ga on 20 Apr 2005 10:01 PDT
 
Willcodeforfood:  Thanks very much for your help.  I figured out the
iframe and it is working perfectly.  Just one last question about an
annoyance.  I have the iframe setup inside a cell in a table.  The
height for that cell is set as "auto".  I have the dimensions for the
iframe set too a default width and a height of 100%.

On one of my pages that I open in hte iframe, the text is long, and is
creating a scroll bar inside the cell.  I have tried changing
combinations of settings around (for the size of the html page being
called, the cell, and the iframe, but I can't figure it out.

Your response is greatly apprecaited, and will be awarding you the answer.  Thanks.
Subject: Re: Web Design - Linking to a cell in a table
From: gojira248-ga on 20 Apr 2005 10:05 PDT
 
Sorry for all the messages, but just to clarify, I want users to
scroll down using their main browers scroll bar, and not a seperate
one inside the page (the one being created in the iframe cell). 
Thanks.
Subject: Re: Web Design - Linking to a cell in a table
From: willcodeforfood-ga on 20 Apr 2005 12:10 PDT
 
gojira248,

I can give you a script to dynamically resize the iframe so that
scrollbars don't show and none of the content is clipped.  Will that
help you?
Subject: Re: Web Design - Linking to a cell in a table
From: gojira248-ga on 20 Apr 2005 15:40 PDT
 
That would be a huge help.  you can see the problem at: 

www.quickhomefix.com/aboutus 

the text on that first page continues below what you see now.  It is
not formatted or anything now, still a work in progress.  Thanks.  (I
have it set now to never allow the scroll bar in the cell)
Subject: Re: Web Design - Linking to a cell in a table
From: willcodeforfood-ga on 21 Apr 2005 09:50 PDT
 
I made two files to demonstrate how to automatically resize the height
of an iframe so that its content will not be clipped.

====================================

Here is the sample main page that contains the iframe:

<html>
<head>
	<script>
	function sizeContent(height)
	{
		var fme = document.getElementById("fmeContent")
		fme.style.height = height + "px"
	}
	</script>
</head>
<body>
	<iframe src="iframe.htm" id="fmeContent" style="height:50px;
width:400px" scrolling="no">
</body>
</html>

====================================

Here is the sample content page, for me it was named iframe.htm:

<html>
<head>
	<script>
	function resizeMe()
	{
		var h = document.getElementById("main").clientHeight
		parent.sizeContent(h)
	}
	</script>
</head>
<body onLoad="resizeMe()">
	<table><tr><td id="main">
	Put your content here.
	</td></tr></table>
</body>
</html>
Subject: Re: Web Design - Linking to a cell in a table
From: gojira248-ga on 21 Apr 2005 12:55 PDT
 
willcodeforfood,  thanks for the codes.  For hte first part, would I
paste this code for each of the pages I need to have resized, in this
case, iframe.htm, iframe2.htm, etc.  Thanks.

Also, I can't seem to find a link to award you the answer fee.  Please
let me know so I can do so.
Subject: Re: Web Design - Linking to a cell in a table
From: willcodeforfood-ga on 21 Apr 2005 13:24 PDT
 
I'm not a researcher so my help is free to you.  To get this sample
working in your current files:

1) put this in your main file inside the <head> tag:

	<script>
	function sizeContent(height)
	{
		var fme = document.getElementById("fmeContent")
		fme.style.height = height + "px"
	}
	</script>

2) put this attribute in the main page's iframe tag:

   id="fmeContent"

3) put this script in the <head> tag of each page that will be
displayed inside the main page's iframe:

	<script>
	function resizeMe()
	{
		var h = document.getElementById("main").clientHeight
		parent.sizeContent(h)
	}
	</script>

4) put this attribute in the body tag of each page that will be
displayed inside the iframe:

     onLoad="resizeMe()"

5) put the following tags around the entire content of each page that
will be displayed inside the iframe:

   <body>                                  
       Welcome to our site....
       ...Thanks for visiting.
   </body>  
                           
  becomes...

   <body onLoad="resizeMe()">                                  
   <table><tr><td id="main">                        <-- add tags here
       Welcome to our site....
       ...Thanks for visiting.
   </td></tr></table>                               <-- and here
   </body>  


Good luck with your venture.
Subject: Re: Web Design - Linking to a cell in a table
From: gojira248-ga on 21 Apr 2005 23:41 PDT
 
willcodeforfood,

Firstly, thank you so much for your help thus far.  I have one more
issue regarding the resizing, so I would really appreciate your help,
but if you are too busy, please don't feel back letting me know.

The resize function is all setup and working, but...only on the first
page that is called (lets call it page1, from the left nav bar).  When
the other pages (page2, page3, etc) are selected from the left nav
bar, the body cell doesnt resize.  You coding is clearly working
perfectly for that first page as the cell clearly resizes, but after
that, the other pages are stuck within the size set by that first
page.  It looks like it is an issue of getting the function to be
redone. I have tried everything I can think of, and nothing seems to
fix it.

Thank you so much for your help!
Subject: Re: Web Design - Linking to a cell in a table
From: gojira248-ga on 22 Apr 2005 01:46 PDT
 
willcodeforfood,

Please disregard the previous message.  I have it all figured out, and
everything of working fine.  Thanks very much!!!

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy