Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table Layout

Status
Not open for further replies.

bluedollar

Programmer
Jul 24, 2003
174
GB
I have a number of tables which display as shown below:

---------------------------------------------------
: header :
: :
---------------------------------------------------
: : :
: : :
: : main :
: : :
: menu : :
: : :
: : :
---------------------------------------------------
: footer :
---------------------------------------------------

The layout shown above works fine, however the pages that are displayed in my main are displayed as follows:

----------------------------------------------
: ----------------------------------------- :
: : unwanted gap : :
: ----------------------------------------- :
: : page i want to display : :
: : : :
: : : :
: ----------------------------------------- :
----------------------------------------------

I can not work out how to lose the gap at the top, have messed about with the html for ages without any positive results. The html for the main is shown below:

function mainstart() {
echo'<td><table border=&quot;1&quot;><tr><td>';
}

Then the code for the top part of a page that is displayed in main is shown below:

function info1() {

echo'<html>';
echo'<head>';
echo'<title></title>';
echo'<link rel=&quot;stylesheet&quot; href=&quot;mystyle.php&quot;>';
echo'</head>';
echo'<body>';
echo'<table border=&quot;1&quot; width=&quot;100%&quot; align=&quot;center&quot;>';
$SQL = &quot;select active_id from active&quot;;
include_once(&quot;Cconnection.php&quot;);
$this->obconnect = new connect_class();
$this->obconnect->connection();
$this->obconnect->dbconnect();
$this->id = $this->obconnect->selectcol($SQL,&quot;active_id&quot;);

}

function title() {


$SQL = &quot;select title from conference where conf_id = '$this->id'&quot;;
$title = $this->obconnect->selectcol($SQL,&quot;title&quot;);
echo'<tr><th class=&quot;1&quot;>'.$title.'</th></tr>';
}

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

The full code listing for the template is shown below:

<?php

class template_class {

function header() {
echo'<table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot;>';
echo'<tr><td></td></tr>';
echo'<tr><td></td><td><img src=&quot;\\graphics/untitled-4.png&quot; border=&quot;1&quot;></td><td></td></tr>';
echo'<tr><td><br></td></tr>';
echo'</table>';
}

function menu() {
//session_start();
echo'<table cellspacing=&quot;0&quot;>';
echo'<tr valign=&quot;top&quot;><td width=&quot;150&quot;>';

#personal table
if (isset ($_SESSION['email'])) {
echo'<table width=&quot;120&quot; bgcolor=&quot;#CACCCD&quot; border=&quot;0&quot;>';
include_once(&quot;Cconnection.php&quot;);
$obconnect = new connect_class();
$obconnect->connection();
$obconnect->dbconnect();
$email_ = $_SESSION['email'];
$type_ = $_SESSION['type'];
$type_ .= 's';
$SQL = &quot;select first_name from $type_ where email = '$email_'&quot;;
$result1 = $obconnect->selectcol($SQL,&quot;first_name&quot;);
$SQL = &quot;select last_name from $type_ where email = '$email_'&quot;;
$result2 = $obconnect->selectcol($SQL,&quot;last_name&quot;);
echo'<tr><th class=&quot;4&quot;>'.$result1.' '.$result2.'</th></tr>';
echo'<tr><td class=&quot;2&quot;>';
if ($type_==&quot;Attendees&quot;) { echo'<A class=&quot;1&quot; HREF=&quot;../editattendee.php&quot;>'; }
else if ($type_==&quot;Reviewers&quot;) { echo'<A class=&quot;1&quot; HREF=&quot;../editauthor.php&quot;>'; }
else if ($type_==&quot;Authors&quot;) { echo'<A class=&quot;1&quot; HREF=&quot;../editreviewer.php&quot;>'; }
echo'edit profile</a></td></tr>';
if (($_SESSION['social'] !=&quot;&quot;) or ($_SESSION['proc'] != &quot;&quot;) or ($_SESSION['acc'] != &quot;&quot;) or ($_SESSION['accep'] != &quot;&quot;)) {
echo'<tr><td class=&quot;2&quot;><A class=&quot;1&quot; HREF=&quot;../checkout.php&quot;>checkout</a></td></tr>';
}
echo'<tr><td class=&quot;2&quot;><A class=&quot;1&quot; HREF=&quot;../logout.php&quot;>logout</a></td></tr>';
echo'</table>';
}
else if ((isset($_SESSION['social'])) or (isset($_SESSION['proc'])) or (isset($_SESSION['accom'])) or (isset($_SESSION['accep']))) {
echo'<table width=&quot;120&quot; bgcolor=&quot;#CACCCD&quot; border=&quot;0&quot;>';
echo'<tr><td class=&quot;2&quot;><A class=&quot;1&quot; HREF=&quot;../checkout.php&quot;>checkout</a></td></tr>';
echo'</table>';
}

echo'<P>';
//echo'<table border=&quot;0&quot; bordercolor=&quot;#000000&quot;><tr><td>';
//echo'<table BORDER=1 CELLSPACING=0 CELLPADDING=2 BORDERCOLOR=000000><TR><td>';
echo'<table bgcolor=&quot;#CACCCD&quot; width=&quot;120&quot; BORDER=1 CELLSPACING=0 CELLPADDING=2 BORDERCOLOR=000000>';
echo'<tr><th class=&quot;4&quot;>Site Navigation</th></tr>';
if ($_SESSION['email']==&quot;&quot;) {
echo'<tr><td class=&quot;2&quot;><A class=&quot;1&quot; HREF=&quot;../login.php&quot;>login</A></td></tr>';
}
$SQL = &quot;select active_id from active&quot;;
include_once(&quot;Cconnection.php&quot;);
$obconnect = new connect_class();
$obconnect->connection();
$obconnect->dbconnect();
$active_conf = $obconnect->selectcol($SQL,&quot;active_id&quot;);

#conference link
$SQL = &quot;select info from conference where conf_id = '$active_conf'&quot;;
$info = $obconnect->selectcol($SQL,&quot;info&quot;);
if ($info==1) {
echo'<tr><td class=&quot;2&quot;><A class=&quot;1&quot; HREF=&quot;../showinfo.php&quot;>Information</A></td></tr>';
}

#timetable link
$SQL = &quot;select timetable from conference where conf_id = '$active_conf'&quot;;
$timetable = $obconnect->selectcol($SQL,&quot;timetable&quot;);
if ($timetable==1) {
echo'<tr><td class=&quot;2&quot;><A class=&quot;1&quot; HREF=&quot;../showtimetable.php&quot;>Timetable</A></td></tr>';
}

#accomodation link
$SQL = &quot;select accomodation from conference where conf_id = '$active_conf'&quot;;
$accomodation = $obconnect->selectcol($SQL,&quot;accomodation&quot;);
if ($accomodation==1) {
echo'<tr><td class=&quot;2&quot;><A class=&quot;1&quot; HREF=&quot;../showaccomodation.php&quot;>Accomodation</A></td></tr>';
}

#social link
$SQL = &quot;select social from conference where conf_id = '$active_conf'&quot;;
$social = $obconnect->selectcol($SQL,&quot;social&quot;);
if ($social==1) {
echo'<tr><td class=&quot;2&quot;><A class=&quot;1&quot; HREF=&quot;../showsocial.php&quot;>Social Event</A></td></tr>';
}

#procedures link
$SQL = &quot;select proc from conference where conf_id = '$active_conf'&quot;;
$proc = $obconnect->selectcol($SQL,&quot;proc&quot;);
if ($proc==1) {
echo'<tr><td class=&quot;2&quot;><A class=&quot;1&quot; HREF=&quot;../showprocedures.php&quot;>Procedures</A></td></tr>';
}
//$obconnect->closelink();

#registration link
$SQL = &quot;select registration_date from conference where conf_id = '$active_conf'&quot;;
$result = $obconnect->selectcol($SQL,&quot;registration_date&quot;);
$reg_date = explode(&quot;-&quot;,$result);
$reg_datet = mktime(24,0,0,$reg_date[1],$reg_date[2],$reg_date[0]);

if (($_SESSION['email']==&quot;&quot;) && ($reg_datet >= time())) {
#visitor registration
echo'<tr><td><br><table /*bgcolor=&quot;#999999&quot;*/ align=&quot;center&quot; border=&quot;0&quot;>';
echo '<form name=&quot;type&quot; action=&quot;registerscript.php&quot; METHOD=POST>';
echo'<tr><td>Register as: </td></tr>';
echo'<tr><td class=&quot;2&quot;><SELECT name=&quot;type&quot;><OPTION>Attendee<OPTION>Author<OPTION>Reviewer</SELECT></td></tr>';
echo'<tr><td class=&quot;2&quot;><input type=submit name=&quot;register&quot; value=&quot;Register&quot;></td></tr>';
echo'</form></table></td></tr>';

}
echo'</table>';
//echo'</td></tr></table>';
echo'</td>';
}

function mainstart() {
echo'<td><table border=&quot;1&quot;><tr><td>';
}

function mainend() {
echo'</td></tr></table></td></tr></table>';
}

function footer() {
echo'<table width=&quot;100%&quot; cellspacing=&quot;0&quot;>';
echo'<tr><td><br><hr><pre>© 2003 Dan Polhill </pre></td></tr>';
echo'</table>';
}
}

?>

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

Any help would be greatly appreciated

Thanks

Dan

 
Sure would help if you just posted the HTML that was output by the PHP....

My guess is that you need to put a &quot;valign=top&quot; in the TD that holds you main section.

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
The html that php produces is as below:

<table width=&quot;100%&quot; border=&quot;1&quot; cellspacing=&quot;0&quot;><tr><td></td></tr><tr><td></td><td><img src=&quot;\graphics/untitled-4.png&quot; border=&quot;1&quot;></td><td></td></tr><tr><td><br></td></tr></table><table border=&quot;1&quot; cellspacing=&quot;0&quot;><tr valign=&quot;top&quot;><td width=&quot;150&quot;><P><table bgcolor=&quot;#CACCCD&quot; width=&quot;120&quot; BORDER=1 CELLSPACING=0 CELLPADDING=2 BORDERCOLOR=000000><tr><th class=&quot;4&quot;>Site Navigation</th></tr><tr><td class=&quot;2&quot;><A class=&quot;1&quot; HREF=&quot;../login.php&quot;>login</A></td></tr><tr><td class=&quot;2&quot;><A class=&quot;1&quot; HREF=&quot;../showinfo.php&quot;>Information</A></td></tr><tr><td class=&quot;2&quot;><A class=&quot;1&quot; HREF=&quot;../showtimetable.php&quot;>Timetable</A></td></tr><tr><td class=&quot;2&quot;><A class=&quot;1&quot; HREF=&quot;../showaccomodation.php&quot;>Accomodation</A></td></tr><tr><td class=&quot;2&quot;><A class=&quot;1&quot; HREF=&quot;../showsocial.php&quot;>Social Event</A></td></tr><tr><td class=&quot;2&quot;><A class=&quot;1&quot; HREF=&quot;../showprocedures.php&quot;>Procedures</A></td></tr></table></td><td valign=&quot;top&quot;><table border=&quot;1&quot;><tr><html><head><title></title><link rel=&quot;stylesheet&quot; href=&quot;mystyle.php&quot;></head><body><table border=&quot;1&quot; width=&quot;100%&quot; valign=&quot;top&quot; align=&quot;center&quot;><tr><th class=&quot;1&quot;>The Title</th></tr><tr><td><br><pre>It is going to be so good, highlights include:

</pre></td></tr><br><table width=&quot;100%&quot;><tr><th class=&quot;2&quot;>Prices</th></tr></table><br><table><form name=&quot;type&quot; action=&quot;checkoutscript.php&quot; METHOD=POST><tr><th class=&quot;3&quot;>Minted</th><td class=&quot;1&quot;> £50.95</td><td></td><td width=&quot;100%&quot; align=&quot;right&quot;><input type=&quot;hidden&quot; name=&quot;accep_item_id&quot; value=&quot;4&quot;><input type=&quot;image&quot; src=&quot;\graphics/basketbutton6.gif&quot; name=&quot;caccep&quot;></td></tr></form><form name=&quot;type&quot; action=&quot;checkoutscript.php&quot; METHOD=POST><tr><th class=&quot;3&quot;>Plebs</th><td class=&quot;1&quot;> £20.54</td><td></td><td width=&quot;100%&quot; align=&quot;right&quot;><input type=&quot;hidden&quot; name=&quot;accep_item_id&quot; value=&quot;1&quot;><input type=&quot;image&quot; src=&quot;\graphics/basketbutton6.gif&quot; name=&quot;caccep&quot;></td></tr></form><form name=&quot;type&quot; action=&quot;checkoutscript.php&quot; METHOD=POST><tr><th class=&quot;3&quot;>Students</th><td class=&quot;1&quot;> £0.00</td><td></td><td width=&quot;100%&quot; align=&quot;right&quot;><input type=&quot;hidden&quot; name=&quot;accep_item_id&quot; value=&quot;3&quot;><input type=&quot;image&quot; src=&quot;\graphics/basketbutton6.gif&quot; name=&quot;caccep&quot;></td></tr></form></table><BR><BR><table width=&quot;100%&quot;><tr><th class=&quot;2&quot;>Dates</th></tr></table><P><table border=&quot;0&quot;><tr><th class=&quot;3&quot;>Start Date:</th><td class=&quot;1&quot;>31/07/2003</td></tr><tr><th class=&quot;3&quot;>End Date:</th><td class=&quot;1&quot;>31/07/2003</td></tr><tr><th class=&quot;3&quot;>Paper Review Date: </th><td class=&quot;1&quot;>31/07/2003</td></tr><tr><th class=&quot;3&quot;>Paper Acceptance End Date: </th><td class=&quot;1&quot;>31/07/2003</td></tr><tr><th class=&quot;3&quot;>Registration End Date: </th><td class=&quot;1&quot;>10/08/2003</td></tr><tr><th class=&quot;3&quot;>Paper Submission End Date: </th><td class=&quot;1&quot;>31/07/2003</td></tr></table></td></table></body></html></td></tr></table></td></tr></table><table width=&quot;100%&quot; cellspacing=&quot;0&quot;><tr><td><br><hr><pre>&copy 2003 Dan Polhill Computer Software Engineering</pre></td></tr></table>
 
if the 'main' area is actually contained within a table cell (TD tag) then make sure that the table tag immediately follows the open td tag eg...

<td><table width=&quot;100%&quot; border=&quot;1&quot; cellspacing=&quot;0&quot;>

instead of

<td>
<table width=&quot;100%&quot; border=&quot;1&quot; cellspacing=&quot;0&quot;><

you also have an empty row before and after...
<img src=&quot;\graphics/untitled-4.png&quot; border=&quot;1&quot;>
that may be causing unwanted space


It would also be ueful if you could send the entire output of the view source if none of the above ideas work

on error goto hell
 
This codes is messy:

<td valign=&quot;top&quot;><table border=&quot;1&quot;><tr><html><head><title></title><link rel=&quot;stylesheet&quot; href=&quot;mystyle.php&quot;></head><body><table border=&quot;1&quot; width=&quot;100%&quot; valign=&quot;top&quot; align=&quot;center&quot;><tr><th class=&quot;1&quot;>The Title</th></tr><tr><td><br><pre>It is going to be so good, highlights include:
</pre></td></tr>

why are you putting head and title tags here?

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
sorry, I can't go through your code right now, but here're two helpful tips with php:

1. if you don't use special php code, you can just write plain html. it will work the same, e.g.

function header() {

?>

<table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<td></td>
</tr>
<tr>
<td></td>
<td><img src=&quot;\\graphics/untitled-4.png&quot; border=&quot;1&quot;></td>
<td></td>
</tr>
<tr>
<td><br/></td>
</tr>
</table>

<?

}

That will produce same result but will look more readable and will help you find errors.

2. when writing with php is unavoidable, end every line with \n . That will force a line break in the output. Again, something you will be glad to have when you debug your code.

Sorry if I didn't help with the problem, but this should be helpful anyway
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top