Code: Select all
function displayNews($all = 0) {
global $db, $max_items, $index;
/* query for news items */
if ($all == 0) {
$query = ("SELECT title,author,topic,content,DATE_FORMAT(date, '%Y-%m-%d') as date FROM news ORDER BY date DESC");
} else {
$query = ("SELECT title,author,topic,content,DATE_FORMAT(date, '%Y-%m-%d') as date FROM news ORDER BY date DESC");
}
$result = mysql_query($query)or die (mysql_error());
while ($row = mysql_fetch_array($result)) {
$date = $row['date'];
$author = $row['author'];
$topic = $row['topic'];
$title = htmlentities ($row['title']);
$news = nl2br (strip_tags ($row['content']));
$display .= "<h1>$title</h1>";
$display .= "<h2>$date</h2>";
$display .= "<h2>By: $author</h2>";
$display .= "<h3>Topic: $topic</h3>";
$display .= "$news";
$display .= "<h4></h4>";
$index->replace_tags(array(
"errormsg" => "$msg",
"news" => "$display",
));
}
}
displayNews();Code: Select all
$index->replace_tags(array(
"errormsg" => "$msg",
"news" => "$display",
));