Aqui el codigo que uso para obtener las ultimas noticias
Código PHP:
function ultimasnoticias($numNews = '1', $template = 'latestNews') {
$sql = "SELECT
gamecms_news.newsId,
gamecms_news.subject,
gamecms_news.shortNews,
gamecms_news.iconId,
gamecms_news.releaseDateTime,
gamecms_system.systemAbbrev
FROM
gamecms_newsSystemLink
LEFT JOIN
gamecms_news
ON
gamecms_newsSystemLink.newsId = gamecms_news.newsId
LEFT JOIN
gamecms_system
ON
gamecms_newsSystemLink.systemId = gamecms_system.systemId
WHERE
auth='1'
AND
gamecms_news.deleted='0'
ORDER BY
releaseDateTime
DESC
LIMIT 0, ".$numNews;
$this->db->query($sql);
$divClass1 = "t2";
$divClass2 = "t1";
$rowNumber = 0;
while($this->db->next_record()) {
$newsId = $this->db->f("newsId");
$subject = $this->db->f("subject");
$shortNews = $this->db->f("shortNews");
$iconId = $this->db->f("iconId");
$releaseDateTime = $this->db->f("releaseDateTime");
$consola = $this->db->f("systemAbbrev");
$timestamp = $this->db->f("releaseDateTime");
$year = trim(substr($timestamp, 0, 4));
$month = trim(substr($timestamp, 5, 2));
$day = trim(substr($timestamp, 8, 2));
$hour = trim(substr($timestamp, 11, 2));
$minute = trim(substr($timestamp, 14, 2));
$date = $month . "-" . $day . "-" . $year;
$newDate = date("M j, Y", mktime(0,0,0,$month,$day,$year));
$time = $hour . ":" . $minute;
$divClass = ($rowNumber % 2) ? $divClass1 : $divClass2;
$rowNumber++;
include "./templates/".$template.".tpl.php";
}
}