table question

JavaScript and client side scripting.

Moderator: General Moderators

Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

table question

Post 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>
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Re: table question

Post 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.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post 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!
User avatar
johnperkins21
Forum Contributor
Posts: 140
Joined: Mon Oct 27, 2003 4:57 pm

Post by johnperkins21 »

Do you need to use new rows for each link? Can you get away with using <br>?
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

ahha!! Thanks alot Bentinel! I got it to work!
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post 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
User avatar
no_memories
Forum Contributor
Posts: 145
Joined: Sun Feb 01, 2004 7:12 pm
Location: New York City

Post 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>
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post 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!.
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post 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?
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

ok, how else would you suggest doing it? I'd really liek to know.
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post 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.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

hmm... Ok, ill have to try that. Looks simple enough!
Draco_03
Forum Regular
Posts: 577
Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada

Post 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..
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post 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
Draco_03
Forum Regular
Posts: 577
Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada

Post by Draco_03 »

Illusionist can you give a link ?
Post Reply