Código HTML:
function getLatestReviewsAndPreviews($numArticles = '1') { $sql = "SELECT gamecms_article.articleId, gamecms_article.title, gamecms_system.systemAbbrev, gamecms_category.category FROM gamecms_article LEFT JOIN gamecms_category ON gamecms_article.categoryId = gamecms_category.categoryId LEFT JOIN gamecms_articleSystemLink ON gamecms_article.articleId = gamecms_articleSystemLink.articleId LEFT JOIN gamecms_system ON gamecms_articleSystemLink.systemId = gamecms_system.systemId WHERE (gamecms_category.category = 'Reviews' OR gamecms_category.category = 'Previews' OR gamecms_category.category = 'Articles') AND gamecms_article.auth='1' AND gamecms_article.deleted='0' ORDER BY gamecms_article.timestamp DESC"; if ($numArticles != '*') { $sql = $sql." LIMIT 0, ".$numArticles; } $this->db->query($sql); while($this->db->next_record()) { $articleId = $this->db->f("articleId"); $title = $this->db->f("title"); if ($this->db->f("category") == 'Reviews') { include "./templates/latestReviews.tpl.php"; } elseif ($this->db->f("category") == 'Articles') { include "./templates/latestArticles.tpl.php"; } else { include "./templates/latestPreviews.tpl.php"; } } }
Saludos