Jump to content

Latest news panel


adnann

Recommended Posts

hi

I have instaled a latest news panel on my site but I want it to show news from one category and to show the news with picture

 

<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2007 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------+
| latest_news_panel by flyingduck
| Shows latest newslinks in a panel
| http://www.flyingduck.dk
+----------------------------------------------------*/
if (!defined("IN_FUSION")) { header("Location: ../../index.php"); exit; }

openside($locale['046']);
$result = dbquery("SELECT * FROM ".$db_prefix."news ORDER BY news_datestamp DESC LIMIT 0,10");
if (dbrows($result) != 0) {
while ($data = dbarray($result)) {
	$itemsubject = trimlink($data['news_subject'], 23);
	echo "<img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."news.php?readmore=".$data['news_id']."' title='".$data['news_subject']."' class='side'>$itemsubject</a><br>\n";
}
} else {
echo "<center>".$locale['047']."</center>\n";
}
closeside();
?>

Link to comment
https://forums.phpfreaks.com/topic/113941-latest-news-panel/
Share on other sites

if your table has a category field use that in a where clause.

 

Example:

in your news table there is a field called "category" you can set a category name or id and look for that

$category = '1';
$result = dbquery("SELECT * FROM ".$db_prefix."news WHERE `category` = '$category' ORDER BY news_datestamp DESC LIMIT 0,10");

 

Ray

 

Link to comment
https://forums.phpfreaks.com/topic/113941-latest-news-panel/#findComment-585598
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.