Page 1 of 2

table question

Posted: Thu Mar 25, 2004 11:07 am
by Illusionist
Ok, i hate tables. I've never been any good with them. Anyways, what i'm wanting to do is have navigation side-bar on the left, and a frame in the middle of the page. It works the way i want, only thing is the links ont he left are spaced out more than i want them to be. What im doing is adding the frame off the first row and setting it rowspan=9, 9 because that how many rows i have... Anyways, my frame has to stay the size it is right now... Well... My way of doing this is probably not the easiest way or the best way. So does anyone have any suggestions?? here is sortof how im doing it:

Code: Select all

<table cellpadding=0 cellspacing=0>
<tr><td>Link1</td>
<td rowspan=9>
<?
if (isset($_GET&#1111;'page']))&#123;
	echo "<iframe src="main.php?page=$page" width=390 height=320 frameborder=0 name="iframe1"></iframe>";
&#125;else&#123;
	echo "<iframe src="main.php?page=main" width=390 height=320 frameborder=0 name="iframe1"></iframe>";
&#125;
?>
</td></tr>
<tr><td>Link2</td></tr>
<tr><td>Link3</td></tr>
<tr><td>Link4</td></tr>
<tr><td>Link5</td></tr>
<tr><td>Link6</td></tr>
<tr><td>Link7</td></tr>
<tr><td>Link8</td></tr>
<tr><td>Link9</td></tr>
</table>

Re: table question

Posted: Thu Mar 25, 2004 1:16 pm
by TheBentinel.com
You might find it easier and less fragile to use nested tables. Have one 1-row, 2-column main table. The first column has your links, the second has your frame. In the first column, have another table that contains all your links. That way you can mess around with the links table and not break stuff in the outer table.

Posted: Thu Mar 25, 2004 1:59 pm
by Illusionist
ya i thought about that, but again im not that good with tables. ill try t and see what i can do though. Thanks!

Posted: Thu Mar 25, 2004 2:05 pm
by johnperkins21
Do you need to use new rows for each link? Can you get away with using <br>?

Posted: Thu Mar 25, 2004 2:09 pm
by Illusionist
ahha!! Thanks alot Bentinel! I got it to work!

Posted: Thu Mar 25, 2004 2:10 pm
by Illusionist
johnperkins21 wrote:Do you need to use new rows for each link? Can you get away with using <br>?
I was doing that before and it was sloppy. Especially when i needed to add something. Looked real bad

Posted: Sun Mar 28, 2004 7:43 am
by no_memories
Hi,

If you would be so kind as to show me the working example (Link), I could possibly help you out. I can get a better picture when looking at the entire source after the page has loaded.

Otherwise I can only suggest using the height and width attributes to control the dimensions of your cells. I.E. Try setting the table width and height first, then work you way down.

For more information on tables, try looking at the 4.01 specs on the W3C site. http://www.w3.org/TR/html401/struct/tables.html

Give this a try --

Code: Select all

<table height="0" width="490" border="0" cellpadding=0 cellspacing=0 summary="Main Table">

<colgroup>
<col width="100"> <!-- 1st Col Width -->
<col width="390"> <!-- 2nd Col Width -->
</colgroup>

<tr><td>

<table border="1" cellpadding="2" cellspacing="0" summary="Link Table">
<tr><td>Link1</td></tr>
<tr><td>Link2</td></tr>
<tr><td>Link3</td></tr>
<tr><td>Link4</td></tr>
<tr><td>Link5</td></tr>
<tr><td>Link6</td></tr>
<tr><td>Link7</td></tr>
<tr><td>Link8</td></tr>
<tr><td>Link9</td></tr>
</table>

</td>

<td>

<table border="0" cellpadding="0" cellspacing="0" summary="PhP iframe Table">
<tr><td>

<?
if (isset($_GET&#1111;'page']))&#123;
   echo "<iframe src="main.php?page=$page" width=390 height=320 frameborder=0 name="iframe1"></iframe>";
&#125;else&#123;
   echo "<iframe src="main.php?page=main" width=390 height=320 frameborder=0 name="iframe1"></iframe>";
&#125;
?>

</td></tr>
</table>

</td></tr>
</table>

Posted: Mon Mar 29, 2004 10:53 am
by Illusionist
uhh... what did you not understand about:
Illusionist wrote:ahha!! Thanks alot Bentinel! I got it to work!
meaning i already figured it out.

Sorry you just a little late!.

Posted: Mon Mar 29, 2004 6:07 pm
by Unipus
Question (don't take this the wrong way): if you hate tables and you're no good with them, why are you using them for something that doesn't need them?

Posted: Mon Mar 29, 2004 9:31 pm
by Illusionist
ok, how else would you suggest doing it? I'd really liek to know.

Posted: Tue Mar 30, 2004 11:34 am
by Unipus
some pseudo code

Code: Select all

<div id="master-container">
     <div id="menu">
           <ul>
               <li>menu item</li>
               <li>menu item</li>
           </ul>
     </div>
     <div id="centered-content">
           blah blah blah
     </div>
</div>

That sounds like all you'd need in your body. Then float/position the DIVs and restyle the ULs... make your life a lot easier, and easier for visitors too.

Posted: Wed Mar 31, 2004 9:52 pm
by Illusionist
hmm... Ok, ill have to try that. Looks simple enough!

Posted: Thu Apr 01, 2004 8:56 am
by Draco_03
CSS + DIV can do pretty much everything.. table are just your last ressource usually.. when you want something to be exactly "there" in your page and in all browser to look very similar..

Posted: Mon Apr 05, 2004 7:44 pm
by Illusionist
Unipus, i jsut got around to testing the code you showed me. Although, it procudes something like:
  • menu item
  • menu item
blah blah blah

Is there any way, other than using a table, to get the centered-content div, beside the menu items?? Thanks.

edit: nvm forgot about CSS positioning! hehe

Posted: Tue Apr 06, 2004 8:27 am
by Draco_03
Illusionist can you give a link ?