XiledWeb
12-22-2006, 09:41 PM
Hi, I have a list of news items that I would like separated by a line break. Whenever I insert a <p> or a <br /> the news items all get surrounded by quotes and seperate the items by more than a line break.
Here is my php:
while ($article = mysql_fetch_array($articles)) {
$id = $article['id'];
$articletext = $article['LEFT(articletext, 120)'];
// If the article text is 120 characters long, add "..." to the end of it
// to indicate that it is actually longer. strlen() returns string length!
if (strlen($articletext) == 120) {
$articletext .= "...";
}
// Remove any custom tags (even partial ones!) in the article text. They are not needed in this preview.
$articletext = ereg_replace('\\[(B|EB|I|EI|L|L=|L=[-_./a-z0-9!&%#?+,\'=:;@~]+|EL|E)?(]|$)', '',
$articletext);
// Finally, make it safe to display in an HTML document
$articletext = htmlspecialchars($articletext);
$author = htmlspecialchars($article['name']);
$email = htmlspecialchars($article['email']);
$adate = $article['articledate'];
echo "<tr valign=\"top\">\n";
echo "<td><a href=\"article.php?id=$id\">$articletext</a></td>\n";
echo "<td><a href=\"mailto:$email\">$author</a></td>\n";
echo "<td>$adate</td>\n";
echo "</tr>\n";
}
?>
Here is my php:
while ($article = mysql_fetch_array($articles)) {
$id = $article['id'];
$articletext = $article['LEFT(articletext, 120)'];
// If the article text is 120 characters long, add "..." to the end of it
// to indicate that it is actually longer. strlen() returns string length!
if (strlen($articletext) == 120) {
$articletext .= "...";
}
// Remove any custom tags (even partial ones!) in the article text. They are not needed in this preview.
$articletext = ereg_replace('\\[(B|EB|I|EI|L|L=|L=[-_./a-z0-9!&%#?+,\'=:;@~]+|EL|E)?(]|$)', '',
$articletext);
// Finally, make it safe to display in an HTML document
$articletext = htmlspecialchars($articletext);
$author = htmlspecialchars($article['name']);
$email = htmlspecialchars($article['email']);
$adate = $article['articledate'];
echo "<tr valign=\"top\">\n";
echo "<td><a href=\"article.php?id=$id\">$articletext</a></td>\n";
echo "<td><a href=\"mailto:$email\">$author</a></td>\n";
echo "<td>$adate</td>\n";
echo "</tr>\n";
}
?>