PDA

View Full Version : And I thought tables were ridiculious!



Beauford
Jul 3rd, 2009, 01:07 AM
I have a CSS layout with two columns and a header and a footer and two smaller headers at the top. can't give site as it is password protected.

I am using php and included a function that contains my header stuff. I call the function from between two divs:

<div id=header>
Call function
</div>

The header css is supposed to put a border and a background color around the header content.

What happens is the box and border is there, but my content from the function is below it. The fuction just includes some php stuff and a nested table, and is formatted perfectly, just not where it is supposed to be.

http://www.gangsterdeath.com/images/Image1.jpg

Hard coding it doesn't work either.

If I Just type ABCD inbetween the divs, no problem.

So are nested tables not allowed, or calling stuff from a function not allowed, I'm lost at this point. 5 hours of scrwing with this - I could really use some help.

Thanks


Header function



<?php

if(!$_SESSION['loggedin'] || $_SESSION['loggedin'] == 0 || $_SESSION['loggedin'] == "") {
header("Location: index.php"); exit;
}

function userdata($ir,$lv,$bm,$fm,$cm) {

global $db, $c, $userid, $set, $ir, $csscode, $registered;

$enperc=(int) ($ir['energy']/$ir['maxenergy']*100);
$wiperc=(int) ($ir['awake']/$ir['maxawake']*100);
$experc=(int) ($ir['exp']/$ir['exp_needed']*100);
$brperc=(int) ($ir['brave']/$ir['maxbrave']*100);
$hpperc=(int) ($ir['hp']/$ir['maxhp']*100);
$enopp=100-$enperc;
$wiopp=100-$wiperc;
$exopp=100-$experc;
$bropp=100-$brperc;
$hpopp=100-$hpperc;
$d="";
$u=$ir['username'];

if($ir['donatordays']) {
$d = "<img src='images/rm.gif' alt='Donator: ".$ir['donatordays']." Days Left' title='Donator: ".$ir['donatordays']." Days Left'>";
}
if($ir['userid'] == 2) {
if($ir['gangPREF']) { $gangPREF = "[<a href='ganginner.php?ID={$ir['gang']}' id='orange'>{$ir['gangPREF']}</a>] "; }
}
else {
if($ir['gangPREF']) { $gangPREF = "[<a href='gangouter.php?ID={$ir['gang']}' id='orange'>{$ir['gangPREF']}</a>] "; }
}

global $staffpage;

echo "
<table border='0' align='left' width='100%'>
<tr valign='top'>
<td width='33%'>
<div style='height: 5px'>&nbsp;</div>";

?>

<div style="line-height: 15pt">
<b>Name: </b><? echo $gangPREF."<a href='".$domain."/viewuser.php?u={$ir['userid']}' {$csscode[$ir['userlevel']-1]}>".$ir['username']."</a> [".$ir['userid']."] ". $d."<br>"; ?>
<b>Money: </b><? echo $fm; if($ir['money'] > 0) { echo " [<a href='".$domain."/deposit.php' id='orange'>Deposit</a>]"; } ?>
<br>
<b>Banked: </b><? if($ir['bankmoney'] < 1) { echo "$0"; } else { echo $bm; }?> [<a href='<? echo $domain; ?>/bank.php' id='orange'>Bank</a>]<br>
<b>Level: </b><? echo $ir['level']; ?><br>
<b>Points: </b><? echo $cm; ?><br>
</div>
</td>
<td width='33%' align='center'>
<table border='0' align='center' width='100%'>

<?

unset($gangPREF);

if($ir['jail']) { $go = "jail.php"; } elseif($ir['hospital']) { $go = "hospital.php"; } else { $go = "#"; }

$on=$db->query("SELECT count(userid) as onnow FROM users WHERE laston > unix_timestamp()-15*60");
$o=$db->fetch_row($on);
echo "<tr><td align='center' style='color: #66CC99; font-face: Arial; font-size: 10pt'><b>Mobsters Online:</b> &nbsp;".$o['onnow']."</td></tr>";
$ru=$db->query("SELECT count(userid) as total FROM users");
$registered=$db->fetch_row($ru);
echo "<tr><td align='center'><b>Registered Mobsters:</b> &nbsp;".$registered['total']."</td></tr>";
echo "<tr><td>&nbsp;</td></tr>";
echo "<tr><td align='center'><a class='info' href='{$go}'>[Ban Information]<span>Jail: {$ir['jail']} Minutes<br>Hosptial: {$ir['hospital']} Minutes<br>Mail Ban: {$ir['mail']} Days<br>Forum Ban: {$ir['forum']} Days</span></a></p></td></tr>";
echo "</table>";
?>

</td>
<td width='34%'>

<table align="right" cellspacing="2">
<tr>
<td><b>Energy:</b>&nbsp;&nbsp;<? echo $enperc."%"; if($enperc < 100) {?>&nbsp;<a href="<? echo $domain; ?>/refills.php?refill=energy">[Refill]</a><?}?></td>
<td>&nbsp;&nbsp;<a href="#" class="tooltip"><img src=images/bar_left.gif height=13><img src=images/bargreen.gif width=<? echo $enperc; ?> height=13><img src="images/barred.gif" width="<? echo $enopp; ?>" height="13"><img src=images/bar_fil_end.gif height=13><span><b>Energy</b>&nbsp;<? echo $ir['energy']."/".$ir['maxenergy']." (".$enperc."%)"; ?></span></a></td>
</tr>

<tr>
<td><b>Awake:</b>&nbsp;&nbsp;<? echo $wiperc."%"; if($wiperc < 100) {?>&nbsp;<a href="<? echo $domain; ?>/refills.php?refill=awake">[Refill]</a><?}?></td>
<td>&nbsp;&nbsp;<a href="#" class="tooltip"><img src=images/bar_left.gif height=13 class='showTip L3' id='tip'><img src=images/barblue.gif width=<? echo $wiperc; ?> height=13 class='showTip L3' id='tip'><img src=images/barred.gif width=<? echo $wiopp; ?> height=13 class='showTip L3' id='tip'><img src=images/bar_fil_end.gif height=13 class='showTip L3' id='tip'><span><b>Awake</b>&nbsp;<? echo $ir['awake']."/".$ir['maxawake']." (".$wiperc."%)"; ?></span></a></td>
</tr>

<tr>
<td><b>Brave:</b>&nbsp;&nbsp;<? echo $ir['brave']."/".$ir['maxbrave']; if($brperc < 100) { ?>&nbsp;<a href="<? echo $domain; ?>/refills.php?refill=brave">[Refill]</a><?}?></td>
<td>&nbsp;&nbsp;<a href="#" class="tooltip"><img src=images/bar_left_purp.gif height=13 class='showTip L4' id='tip'><img src=images/barpurple.gif width=<? echo $brperc; ?> height=13 class='showTip L4' id='tip'><img src=images/barred.gif width=<? echo $bropp; ?> height=13 class='showTip L4' id='tip'><img src=images/bar_fil_end.gif height=13 class='showTip L4' id='tip'><span><b>Brave</b>&nbsp;<? echo $ir['brave']."/".$ir['maxbrave']." (".$brperc."%)"; ?></span></a></td>
</tr>

<tr>
<td><b>EXP:</b>&nbsp;&nbsp;<? echo $experc; ?>%</td>
<td>&nbsp;&nbsp;<a href="#" class="tooltip"><img src=images/bar_left.gif height=13 class='showTip L5' id='tip'><img src=images/bargreen.gif width=<? echo $experc; ?> height=13 class='showTip L5' id='tip'><img src=images/barred.gif width=<? echo $exopp."/".$ir['exp_needed']; ?> height=13 class='showTip L5' id='tip'><img src=images/bar_fil_end.gif height=13 class='showTip L5' id='tip'><span><b>EXP</b>&nbsp;<? echo number_format($ir['exp'])."/".number_format($ir['exp_needed'])." (".$experc."%)"; ?></span></a></td>
</tr>

<tr>
<td><b>Health:</b>&nbsp;&nbsp;<? echo $hpperc; ?>%</td>
<td>&nbsp;&nbsp;<a href="#" class="tooltip"><img src=images/bar_left.gif height=13><img src=images/bargreen.gif width=<? echo $hpperc; ?> height=13><img src=images/barred.gif width=<? echo $hpopp; ?> height=13><img src=images/bar_fil_end.gif height=13><span><b>HP</b>&nbsp;<? echo $ir['hp']."/".$ir['maxhp']." (".$hpperc."%)"; ?></span></a></td>

</tr>
</table>

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

<?
}

?>

jrp1
Jul 3rd, 2009, 01:38 AM
Your question is too vague. You need to provide the CSS so we can tell what the "header" style looks like, and some screenshots of what your problem looks like. Your screenshot is confusing.

Beauford
Jul 3rd, 2009, 01:58 AM
Your question is too vague. You need to provide the CSS so we can tell what the "header" style looks like, and some screenshots of what your problem looks like. Your screenshot is confusing.

Are you serious??

I spent 20 minutes to write it so people would understand it. What part don't you understand. Can you not see in the picture the content (where it says Mobsters Online) is below the brown smaller box above it. It's supposed to be inside it. That's what the problem is.

if you got to http://www.gangsterdeath.com you will see what it is supposed to look like. without the inlcuded text.

Here is the css for the layout.

Thanks




#outer {
text-align:left;
border: 2px solid #444444;
background: #262626;
width:900px;
margin: auto;
}

#block {
text-align:left;
width:880px;
margin: 5px auto 5px auto;
}

#header {
margin: 0px 0px 5px 0px;
color: #E0E0E0;
border: 2px solid #444444;
background: #000000;
padding: 5px;
}

#stats {
margin: 0px 0px 5px 0px;
color: #E0E0E0;
border: 2px solid #444444;
background: #333333;
padding: 5px;
}

#bar {
margin: 0px 0px 5px 0px;
height: 18px;
background:#c0c0c0;
color: #E0E0E0;
border: 2px solid #444444;
background: #333333;
padding: 5px;
}

#black {
padding: 3px 0px 3px 5px;
border-bottom: 1px solid #444444;
border-top: 1px solid #444444;
background: #262626;
}

#bodyblock {
background: #dcdcdc;
color: #333333;
width:880px;
padding:0;
}

#menu {
margin: 5px 0px 5px 0px;
float:left;
color: #E0E0E0;
border: 2px solid #444444;
border-top: 1px solid #444444;
background: #333333;
width:130px;
padding: 5px;
}

#content {
margin: 5px 0px 10px 0px;
float:right;
width:709px;
color: #E0E0E0;
border: 2px solid #444444;
border-top: 1px solid #444444;
background: #333333;
text-align:left;
padding: 5px;
}

#footer {
color: #E0E0E0;
margin-top: 0px;
height:16px;
border: 2px solid #444444;
background: #333333;
padding: 5px;
}

drhowarddrfine
Jul 3rd, 2009, 03:17 AM
I spent 20 minutes to write it so people would understand it.
And it means nothing to a non-PHP coder. Your picture is also worthless. What we need is the generated markup and your included CSS is only half the picture.

We need the COMPLETE generated markup from the first line to the last, plus the complete CSS. A link is preferred cause otherwise we have to paste your markup together to test it and it might not have the images needed for a complete test.

Beauford
Jul 3rd, 2009, 04:17 AM
And it means nothing to a non-PHP coder. Your picture is also worthless. What we need is the generated markup and your included CSS is only half the picture.

We need the COMPLETE generated markup from the first line to the last, plus the complete CSS. A link is preferred cause otherwise we have to paste your markup together to test it and it might not have the images needed for a complete test.

Unbelieveable. If you can't figure out what is going on from what I posted, then your not a programmer at all. This is why I rarely come to these groups as no one can seem to think on their feet and. I don't have to see the ball go over the wall to know it was a home run.

I'll find answers elsewhere.

drhowarddrfine
Jul 3rd, 2009, 04:19 AM
Lol! .

_Aerospace_Eng_
Jul 3rd, 2009, 05:05 AM
Unbelieveable. If you can't figure out what is going on from what I posted, then your not a programmer at all. This is why I rarely come to these groups as no one can seem to think on their feet and. I don't have to see the ball go over the wall to know it was a home run.

I'll find answers elsewhere.

Usually HTML and CSS go hand in hand. Help us help you. Though your likely problem is the fact that you don't know that you need to clear your floats. Don't patronize us. You are the one asking for help not us.

http://www.quirksmode.org/css/clearing.html

bazz
Jul 3rd, 2009, 05:31 AM
I have changed my mind.

abduraooft
Jul 3rd, 2009, 11:07 AM
lol, I've a good link in my signature, but unfortunately the OP may not have the rights to view it now :)


This is why I rarely come to these groups as no one can seem to think on their feet and. I don't have to see the ball go over the wall to know it was a home run. We can't neither produce your html code (by parsing the above PHP) nor guess it!

nick1988
Jul 3rd, 2009, 01:19 PM
lol, I've a good link in my signature, but unfortunately the OP may not have the rights to view it now :)

I've always wanted to read that post :(

effpeetee
Jul 3rd, 2009, 01:59 PM
The laugh is: He has all the code and knows what he wants and HE CAN'T DO IT. Then he castigates us because we can't help him because we have almost nothing to go on.

The mind boggles.

Frank