$news_category_id = "1"; // type your category id here.
$result = dbquery("SELECT * FROM ".DB_NEWS." WHERE news_cat='$news_category_id' ORDER BY news_id ASC, LIMIT 0,15");
if (dbrows($result)>0) {
open_table("News Category");
echo "<ul>";
while ($data = dbarray($result)) {
$news_id = $data['news_id'];
$news_title = $data['news_subject'];
echo "<li><a href='".FUSION_SELF."&readmore=$news_id'> $news_title</a></li>
}
echo "</ul>";
} else { echo "There are no news in this category"; }
closetable();
$news_cat_ids = "1, 2"; //separate each category with a comma and a space
$news_cat_ids = explode(", ", $news_cat_ids);
$i = 0;
if(!empty($news_cat_ids)){
foreach($news_cat_ids as $news_cat_box){
$result = dbquery("SELECT news_cat_name FROM ".DB_NEWS_CATS." WHERE news_cat_id='".intval($news_cat_box)."' LIMIT 0, 1");
if(dbrows($result)){
$data = dbarray($result);
$result = dbquery("SELECT * FROM ".DB_NEWS." WHERE news_cat='".intval($news_cat_box)."' ORDER BY news_id ASC LIMIT 0, 10");
echo "<div style='width:49%;position:relative;padding:1px;magin:1px;float:".(($i % 2 == 0) ? "left" : "right").";overflow:hidden;'>\n";
opentable($data['news_cat_name']);
if(dbrows($result)){
echo "<ul>";
while($data = dbarray($result)){
echo "<li><a href='".BASEDIR."news.php?readmore=".$data['news_id']."'>".$data['news_subject']."</a></li>\n";
}
echo "</ul>";
}else{
echo "<p>No news for this category.</p>\n";
}
closetable();
echo "</div>\n";
}
$i++;
}
echo "<div style='clear:both;'></div>\n";
}
$news_cat_ids = "1, 2";
$news_cat_ids = explode(", ", $news_cat_ids);
$i = 0;
if(!empty($news_cat_ids)){
foreach($news_cat_ids as $news_cat_box){
$result = dbquery("SELECT news_cat_name FROM ".DB_NEWS_CATS." WHERE news_cat_id='".intval($news_cat_box)."' LIMIT 0, 1");
if(dbrows($result)){
$data = dbarray($result);
$result = dbquery("SELECT * FROM ".DB_NEWS." WHERE news_cat='".intval($news_cat_box)."' ORDER BY news_id ASC LIMIT 0, 10");
echo "<div style='width:49%;position:relative;padding:1px;magin:1px;float:".(($i % 2 == 0) ? "left" : "right").";overflow:hidden;'>\n";
opentable($data['news_cat_name']);
if(dbrows($result)){
echo "<ul>";
while($data = dbarray($result)){
echo "<li><a href='".BASEDIR."news.php?readmore=".$data['news_id']."'>".$data['news_subject']."</a></li>\n";
}
echo "</ul>";
echo "<p align='center'><a href='".BASEDIR."news_cats.php?cat_id=".$news_cat_box."'>View All Entries</a></p>\n";
}else{
echo "<p>No news for this category.</p>\n";
}
closetable();
echo "</div>\n";
}
$i++;
}
echo "<div style='clear:both;'></div>\n";
}
Category Forum
Code Snippet and functions - 8Labels
None yet
Statistics
4 participants
Notifications
You are not receiving notifications from this thread.
Related Questions