global $gCms;
$db = $gCms->db;
$result = array();
$query = "SELECT * FROM ".cms_db_prefix()."content
where type = 'content' ORDER BY create_date DESC limit 5";
$dbresult = $db->Execute($query);
if ($dbresult && $dbresult->RowCount() > 0)
{
while ($row = $dbresult->FetchRow())
{
#Make sure the type exists. If so, instantiate and load
if (in_array($row['type'], array_keys(@ContentManager::ListContentTypes())))
{
echo '• '.$row[menu_text].'';
}
}
}
latest articles plugin
latest articles plugin
I've been lurking and gaining knowledge for awhile, so I thought I'd contribute this bit of code that I use as a plugin to display the 5 newest pages on my site...perhaps it will be of use to someone. Note that this uses ".shtml" extensions. Copy this code into a user plugin and put the plugin reference in your template.
Last edited by gravityman on Thu Apr 21, 2005 7:53 am, edited 1 time in total.
Re: latest articles plugin
I recommend to You use passing adodb connection by reference:gravityman wrote: $db = $gCms->db;
Code: Select all
$db = & $gCms->db;