|My “announcer display list” is out of control|
I'm only a rookie, so I would appreciate any help and please don't answer with to complicated replies.
I’m following tuts to build a social network from someone on youtube.
My echo $announcerDisplayList;
Sorry, I had to attache URL: [myglobalpnr.com...] I didnt know how to explain what was going on.
$announcerDisplayList .= '<table width="100%" align="center" cellpadding="4" style="background-color:#CCCCCC; border:#999 1px solid;">
<td width="12%" bgcolor="#FFFFFF" valign="top"><a href="root/res.php?id=' . $uid . '">' . $announcer_pic . '</a>
<td width="100%" bgcolor="#F9F9F9" style="line-height:1.5em;" valign="top"><span class="liteGreyColor textsize10"> ' . $whenAnno . ' <a href="root/res.php?id=' . $uid . '"><strong>' . $username . '</a> Announced: </span><br />
via <em>' . $anno_device . '</em></span><br />
<span class="textsize10"> ' . $the_anno . '</span>
<?php print "$MemberDisplayList"; ?>
<?php print "$announcerDisplayList"; ?></td>
<?php include_once "footer_template.php"; ?>
1. Why are the entries all spaced out?
2. Why “_” between each word.
Seems to be the way $the_anno value is being saved in the db when it's created. It may be getting converted by some function. Double check the db input and the output.
The problem you're raising: Is it that way in your database? If not, it's something in the way it's being output as above. That's the least of your problems though.
You've got tons of things going on, but let's hit a couple obvious ones. First, your link will be removed, BUT you can put it in your profile when you get enough posts.
Second, you really need to work in FireFox, this will alert you to a bunch of stuff. If you are, view source of the page. See all those tags in red (represented by bold here)?
<em></em></span> (Also note empty em)
<a href="root/res.php?id=18"><strong>Example</a> said: </span><br />
(Still working with that "root" folder huh? :-) )
<span class="textsize10"> (some text in here)</span>
Of these, the last td will be most important. All of those red tags (marked by my bold's here) represents an improperly nested tag, or a tag FireFox can't figure out what you mean. Look at the link example: even if you need all the tags you're using there, it should be like this:
<span><a href="root/res.php?id=18"><strong>Example</strong></a> said: </span>
See how they are nested, and one closes before the next, and don't "leapfrog" over?
When it comes to tables for layout, which is a bad idea to start with, you REALLY need to understand tables and get your code to validate (below.) You're opening tags, then not closing them before the closing </td>, and the browser doesn't know what to dowith it.
I suggest copying the source code of this page, putting it in a static file, and sorting out what's wrong, then going back to your PHP code and making the corrections. Using the td example, look:
<table width="100%" align="center" cellpadding="4" style="background-color:#CCCCCC; border:#999 1px solid;">
<td width="10%" bgcolor="#FFFFFF" valign="top"> your link </td>
<td width="100%" bgcolor="#F9F9F9" style="line-height:1.5em;" valign="top">
<span class="liteGreyColor textsize9">
1 day ago <a href="root/res.php?id=18"><strong>Example</a> said: </span><br />
via <em></em></span><br />
<span class="textsize10"> some text here</span>
You open a <strong> but never close it; followed by closing </span> that was never opened; followed by another one.
Further down the page you have
A page only has one body which you've already opened.
Once you get past all this, you may be able to get down to actually solving the problem at hand: by the look of your page, it's looking like the table cell colspans don't add up. You can't even begin to address that problem until you get this other stuff sorted out.
Last, you're using an XHTML doctype and I'm sure you don't know why - this is going to make validation much harder for you. You may want to drop to an HTML 4.01 or HTML 5 doctype. In any case, your first stop is to validate your page output [validator.w3.org]. Use the copy/paste source code method I mentioned, and use the Direct Input tab of the validator to get that cleaned up. When done, migrate what you've learned back into your PHP script, and validate it AGAIN to make sure you have it sorted out.
If the problem doesn't go away at that point, THEN you can look at what's messed up in your table layout.