Pages: [1]   Go Down
Send this topic | Print
Author Topic: Spacing Between Two Tables  (Read 676 times)
MTGap!
Hyper-Active Member
***
Offline Offline

Posts: 352



WWW
« on: November 23, 2008, 09:20:50 AM »

Right now I'm working on some modifications of PHP-Fusion and attempting to have two tables side by side, but I'm having lots of difficulties because I'm getting confused with all of the <table>, <tr>, and <td> tags. So far I can't get it to work.

Here are the two functions for the opentable and closetable. If you use PHP-Fusion you'll be familiar with these:

Code:
function opentable($title) {



echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";

echo "<td class='capmain-left'></td>\n";

echo "<td class='capmain'>".$title."</td>\n";

echo "<td class='capmain-right'></td>\n";

echo "</tr>\n</table>\n";

echo "<table cellpadding='0' cellspacing='0' width='100%' class='spacer'>\n<tr>\n";

echo "<td class='main-body'>\n";


}



function closetable() {



echo "</td>\n";

echo "</tr><tr>\n";

echo "<td style='height:5px;background-color:#f6a504;'></td>\n";

echo "</tr>\n</table>\n";



}

So I'm trying to make it so that the tables are side by side, but I can't seem to be able to get it to work...

I'd especially like it if someone show me a way to make it so that there will be two new functions in between opentable and closetable so that I can have two different titles for the tables.

All of my attempts have led to the two tables, but only one closetable, or the sidebar being shoved down to the bottom. Anyone think they can help me? Any help would be appreciated.
Logged
Primefalcon
Linux Acolyte
Loyal 110MB Member
*******
Online Online

Posts: 4645


Follow the path of Linux, it will lead you....


« Reply #1 on: November 23, 2008, 09:38:32 AM »

try using css positioning....

float would be your best bet

for example

Code:
<table class="table">~~~~~~~~~</table>
<table class="table"">~~~~~~~~~</table>

then in your css
Code:
.table
{ float: left; }

Just incorporate that into your code

I'm not familiar with phpfusion but that'd prob be your go
« Last Edit: November 23, 2008, 09:45:45 AM by primefalcon » Logged

Dropbox is an amazing cloud storage backup solution, get a free 2.25 gigabytes of storage by using THIS LINK

For Tips on Runescape, Visit Marlaine's Musings For Tips on Just about anything Visit Marlainemarie at eHow
MTGap!
Hyper-Active Member
***
Offline Offline

Posts: 352



WWW
« Reply #2 on: November 23, 2008, 09:43:02 AM »

Yeah I tried that, already I asked at this php-fusion related site a long time ago and I tried everything this guy said, but none of them worked as desired:

http://phpfusion-mods.net/forum/viewthread.php?thread_id=290

I just get really confused because there ends up being like 20 table type tags...
Logged
Primefalcon
Linux Acolyte
Loyal 110MB Member
*******
Online Online

Posts: 4645


Follow the path of Linux, it will lead you....


« Reply #3 on: November 23, 2008, 09:45:11 AM »

sorry I just modified the code slightly since unless you want to pass by reference or something you'd probably need to use classes not id's
Logged

Dropbox is an amazing cloud storage backup solution, get a free 2.25 gigabytes of storage by using THIS LINK

For Tips on Runescape, Visit Marlaine's Musings For Tips on Just about anything Visit Marlainemarie at eHow
MTGap!
Hyper-Active Member
***
Offline Offline

Posts: 352



WWW
« Reply #4 on: November 24, 2008, 02:46:47 AM »

Bump, anyone have a solution for me, I just want something simple besides having to modify the CSS and in result having lots of code. There has to be a simple way to have it done...
Logged
OleTom
RoadHo
Active Member
**
Offline Offline

Posts: 69


On The Road Some Where


WWW
« Reply #5 on: November 24, 2008, 03:09:38 AM »

Why can't you put both your tables in a bigger table like



Code:
<table><tr><td>

<table><tr><td>
test
</TD></TR></TABLE>


</td><td>


<table><tr><td>
test
</TD></TR></TABLE>

</TD></TR></TABLE>
« Last Edit: November 24, 2008, 03:22:21 AM by OleTom » Logged

MTGap!
Hyper-Active Member
***
Offline Offline

Posts: 352



WWW
« Reply #6 on: November 24, 2008, 03:33:59 AM »

Well I've been trying that and your post gave me an idea of what to do, but after attempting I'm getting an unexpected end to the php file. I'm thinking I forgot an ending tag somewhere:

Code:
function opentablelpd1($title) {



echo "<table><tr><td>\n";
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";

echo "<td class='capmain-left'></td>\n";

echo "<td class='capmain'>".$title."</td>\n";

echo "<td class='capmain-right'></td>\n";

echo "</tr>\n</table>\n";

echo "<table cellpadding='0' cellspacing='0' width='100%' class='spacer'>\n<tr>\n";

echo "<td class='main-body'>\n";



}

function tablelpd ($title2) {
echo "</td>\n";
echo "</tr><tr>\n";
echo "<td style='height:5px;background-color:#f6a504;'></td>\n";

echo "</tr>\n</table>\n";
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";

echo "<td class='capmain-left'></td>\n";

echo "<td class='capmain'>".$title2."</td>\n";

echo "<td class='capmain-right'></td>\n";

echo "</tr>\n</table>\n";

echo "<table cellpadding='0' cellspacing='0' width='100%' class='spacer'>\n<tr>\n";

echo "<td class='main-body'>\n";



function closetablelpd2($title) {



echo "</td>\n";

echo "</tr><tr>\n";

echo "<td style='height:5px;background-color:#f6a504;'></td>\n";

echo "</tr>\n</table>\n";
echo "</td>\n</tr>\n</table>\n";


}

In my other file that requires the theme.php I wrote:

Code:
$text = "Test";

opentablelpd1($text);
echo "Test";
tablelpd($text);
echo "Test";
closetablelpd2();

Can you see where I goofed up, there is way too many <table> tags...
Logged
OleTom
RoadHo
Active Member
**
Offline Offline

Posts: 69


On The Road Some Where


WWW
« Reply #7 on: November 24, 2008, 04:02:50 AM »

I don't see the line ending Table 1 and opening Table 2 They are both on the same table row so don't /tr


Code:


echo "<table><tr><td>\n";

function opentablelpd1($title) {

echo "<table cellpadding='0' cellspacing='0' width='75%'>\n<tr>\n";
echo "<td class='capmain-left'></td>\n";
echo "<td class='capmain'>".$title."</td>\n";
echo "<td class='capmain-right'></td>\n";
echo "</tr>\n</table>\n";
echo "<table cellpadding='0' cellspacing='0' width='75%' class='spacer'>\n<tr>\n";
echo "<td class='main-body'>\n";

}

echo "</td ><td>\n";

function opentablelpd2($title) {

echo "<table cellpadding='0' cellspacing='0' width='25%'>\n<tr>\n";
echo "<td class='capmain-left'></td>\n";
echo "<td class='capmain'>".$title."</td>\n";
echo "<td class='capmain-right'></td>\n";
echo "</tr>\n</table>\n";
echo "<table cellpadding='0' cellspacing='0' width='25%' class='spacer'>\n<tr>\n";
echo "<td class='main-body'>\n";

}

echo "</td></tr></table>\n";


If I could see one of these tables on a website maybe I could help on the code but I know nothing about PHP-Fusion but have been trying to figure out code for awhile  huh
« Last Edit: November 24, 2008, 04:59:10 AM by OleTom » Logged

MTGap!
Hyper-Active Member
***
Offline Offline

Posts: 352



WWW
« Reply #8 on: November 24, 2008, 05:12:05 AM »

Yeah I forgot that, but still have an issue somewhere:

Code:
function opentablelpd1($title) {



echo "<table><tr><td>\n";
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";

echo "<td class='capmain-left'></td>\n";

echo "<td class='capmain'>".$title."</td>\n";

echo "<td class='capmain-right'></td>\n";

echo "</tr>\n</table>\n";

echo "<table cellpadding='0' cellspacing='0' width='100%' class='spacer'>\n<tr>\n";

echo "<td class='main-body'>\n";



}

function tablelpd ($title2) {
echo "</td>\n";
echo "</tr><tr>\n";
echo "<td style='height:5px;background-color:#f6a504;'></td>\n";

echo "</tr>\n</table>\n";
echo "</td><td>\n";
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";

echo "<td class='capmain-left'></td>\n";

echo "<td class='capmain'>".$title2."</td>\n";

echo "<td class='capmain-right'></td>\n";

echo "</tr>\n</table>\n";

echo "<table cellpadding='0' cellspacing='0' width='100%' class='spacer'>\n<tr>\n";

echo "<td class='main-body'>\n";



function closetablelpd2($title) {



echo "</td>\n";

echo "</tr><tr>\n";

echo "<td style='height:5px;background-color:#f6a504;'></td>\n";

echo "</tr>\n</table>\n";
echo "</td></tr>\n</table>\n";


}
Logged
tpog
Super Authority member
******
Online Online

Posts: 1541


WWW
« Reply #9 on: November 24, 2008, 05:18:45 AM »

function "function tablelpd ($title2) {" hasn't got a closing "}" ??
Logged
MTGap!
Hyper-Active Member
***
Offline Offline

Posts: 352



WWW
« Reply #10 on: November 24, 2008, 05:23:27 AM »

Rofl (smacks myself on head!) Thanks that fixed it...   wink
 
Well that worked here is what it looks like, I guess I can change the side with <td class right?

I'm not sure how to do it though, I want it so like 75% is one table and 25% is the other.
« Last Edit: November 24, 2008, 06:24:46 AM by MTGap! » Logged
Primefalcon
Linux Acolyte
Loyal 110MB Member
*******
Online Online

Posts: 4645


Follow the path of Linux, it will lead you....


« Reply #11 on: November 24, 2008, 08:47:41 AM »

since you seem to have an aversion to using stylesheets why don't you just do something like this...

Code:
<table width="100px"><tr width="100px"><td width="75px">

<table width="75px"><tr]<td]
test
</td]</tr]</TABLE>


</td]<td width="25px">


<table width="25px"><tr]<td]
test
</td]</tr]</table>

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

while this will work the code is rather bloated and you should really check into using css properly

btw: you really should keep all your html tags lowercase
Logged

Dropbox is an amazing cloud storage backup solution, get a free 2.25 gigabytes of storage by using THIS LINK

For Tips on Runescape, Visit Marlaine's Musings For Tips on Just about anything Visit Marlainemarie at eHow
MTGap!
Hyper-Active Member
***
Offline Offline

Posts: 352



WWW
« Reply #12 on: November 24, 2008, 08:58:03 AM »

Well I got it to work thanks  grin, I know CSS, but I prefer coding in PHP. I don't want to have to edit the CSS though because then I'll still end up having to add the functions like I was just doing, since I'm making this for only a section of the site. Thanks for the help though! Been working on this for a while now I can actually get into the real coding...  grin
Logged
Pages: [1]   Go Up
Send this topic | Print
Jump to: