Source

com_prof3tablog / prof3tablog.php

Full commit
roberto.aloi c19376f 































<?php

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

// Connect to the DB
$db =& JFactory::getDBO();

// Select the last 10 Articles
$query = "SELECT * FROM #__prof3ta_blog_articles ORDER BY date DESC;";
$db->setQuery( $query, 0);

// ... And print them!

// Table is not empty
if ($articles = $db->loadObjectList()) {
	$i = 0;
	foreach ($articles as $article) {
		if ($i<10) {
			echo "<h2>" . $article->title . "</h2>";
			echo "<div align='justify'>";
			echo $article->text . "<br /><br />";
			echo "Posted: " . $article->date;
			echo "<hr>";
			echo "</div>";
			$i++;
		}
	}
} else {
	echo "No articles in the database.<br />";
}

?>