This is an old post but for the future...
Text Formatted Code
$exclude=array('');
echo phpblock_lastarticles(10,50,$exclude);
Text Formatted Code
function phpblock_lastarticles($numrows=10, $Length=50, $exclude)
{
global $_CONF, $_TABLES, $LANG04;
//$Length=50;
//$numrows=10;
//Get appropriate stories from DB
$exc = '';
if (count($exclude)>0) {
foreach ($exclude as $topic) {
$exc .= " AND s.tid!='" . $topic ."'";
}
}
$sql = "SELECT STRAIGHT_JOIN s.sid, s.tid,s.title, s.date, s.group_id,s.owner_id,s.perm_owner,s.perm_group,s.perm_members,s.perm_anon,t.topic,s.introtext from {$_TABLES['stories']} as s, {$_TABLES['topics']} as t WHERE s.title<>'' AND (s.tid = t.tid) AND (s.draft_flag = 0)". $exc . " ORDER BY s.date DESC LIMIT " . $numrows;
// echo $sql;
$result = DB_query($sql);
$nrows = DB_numRows($result);
//Display title of stories.
$i=0;
$retval='';
do{
$A = DB_fetchArray($result);
//$descr = filter_ALL_HTML($A['introtext']);
//$descr = mb_strimwidth ($descr, 0, 256, "...");
$datestr = substr($A['date'],0,10);
$TACCESS=SEC_hasTopicAccess($A['tid']);
$ACCESS=SEC_hasAccess($A['owner_id'], $A['group_id'] ,$A['perm_owner'] ,$A['perm_group'] ,$A['perm_members'] ,$A['perm_anon']);
$title = mb_strimwidth ($A['title'], 0, $Length);
if ($ACCESS>0 AND $TACCESS>0)
{
// $title=COM_truncate($A['title'],$Length,'...');
$retval .= '<h1><br/><a class="non-ul" href="' . $_CONF['site_url'] . '/article.php?story=' . $A['sid']. '">' . $title . '<span>' . $descr . '</span></a></h1>' ;
} else {
// $title=COM_truncate($A['title'],$Length,'...');
$retval .= '<h1><br/><span class="non-u">' . $title . "</span></h1>";
}
$retval .= ' on '. $datestr .' Topic '. $A['topic'] .'<br/>';
$i++;
}while ($nrows>$i);
return $retval;
}
$exclude=array('');
echo phpblock_lastarticles(10,50,$exclude);