$result = dbquery("SELECT * FROM ".DB_NEWS." ORDER BY rand() LIMIT 10");
if (dbrows($result)) {
while ($data = dbarray($result)) {
// do your news design here.
print_p($data);
}
}
//----------*Related News panel*--------------//
if ((FUSION_SELF == 'news.php') && isset($_GET['readmore']) && isNum($_GET['readmore']))
{
list($news_subject) = dbarraynum(dbquery("SELECT news_subject from ".DB_NEWS." WHERE news_id=".$_GET['readmore']));
$rel_news_res = dbquery("SELECT news_id, news_subject, news_news, news_image FROM ".DB_NEWS." WHERE MATCH (news_subject) AGAINST ('".$news_subject."' IN BOOLEAN MODE) AND news_id != ".$_GET['readmore']." ORDER BY news_datestamp DESC LIMIT 10");
$langPanel['001'] = "Related News:";
$counter = 0;
$columns = 2; //number of columns per line
if(dbrows($rel_news_res))
{
opentable($langPanel['001']);
echo "<table width='100%'>\n<tr>\n";
while($news = dbarray($rel_news_res))
{
if ($counter != 0 && ($counter % $columns == 0)) // comment out if you want to output in one line
echo "</tr>\n<tr>\n";
echo "<td width='50%'>\n";
echo "<table cellpadding='4' cellspacing='2' width='100%'>\n<tr>\n";
echo "<td><a href='".BASEDIR."news.php?readmore=".$news['news_id']."' alt='".$news['news_subject']."'><img src='".IMAGES_N."".$news['news_image']."' title='".$news['news_subject']."' width='96%' height='auto' /></a><strong><a href='".BASEDIR."news.php?readmore=".$news['news_id']."'>".trimlink(strip_tags(stripslashes($news['news_subject'])), 39)."</a></strong>".trimlink(strip_tags(stripslashes($news['news_news'])), 69)."</td>\n</tr>\n";
echo "</table>\n</td>\n";
$counter++; // comment out if you want to output in one line
}
echo "</tr>\n</table>\n";
closetable();
}
}
//-------------*The end*--------------//
echo "<!--news_sub_readmore-->";
Category Forum
Panels and InfusionsLabels
None yet
Statistics
3 participants
Notifications
You are not receiving notifications from this thread.
Related Questions