homepage Welcome to WebmasterWorld Guest from 54.211.235.255
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
My “announcer display list” is out of control
Scotty13




msg:4452015
 11:01 pm on May 10, 2012 (gmt 0)

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.

PHP entry…

$announcerDisplayList .= '<table width="100%" align="center" cellpadding="4" style="background-color:#CCCCCC; border:#999 1px solid;">
<tr>
<td width="12%" bgcolor="#FFFFFF" valign="top"><a href="root/res.php?id=' . $uid . '">' . $announcer_pic . '</a>
</td>
<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>
</td>
</tr>
</table>';
}
}


</head>
<body>
<p>
<?php print "$MemberDisplayList"; ?>
</p>
</div>
</div>
<?php print "$announcerDisplayList"; ?></td>

</table>
<br />
<br />
</td>
</tr>
</table>
<?php include_once "footer_template.php"; ?>
</body>
</html>



1. Why are the entries all spaced out?
2. Why “_” between each word.

Thanks,
Scott

 

cffrost2




msg:4452041
 12:52 am on May 11, 2012 (gmt 0)

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.

rocknbil




msg:4452290
 4:59 pm on May 11, 2012 (gmt 0)

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)?

</table> </p>

</div>
</div>

<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>
</td>

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?

<span>
<a href>
<strong>
</strong>
</a>
</span>

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;">
<tr>
<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>
</td>
</tr>
</table>

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

<body class="center">

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved