Parašė DJFainulka· 2009 Sau. 31 20:01:39
#9
Sveiki. Gal kas galite į šį naujienų failą įdėti komentarus? Nu kad paspaudis skaityti toliau po naujiena galima būtų parašyti komentarą.
Kodas:
<?
require_once "maincore.php";
require_once "subheader.php";
require_once "side_left.php";
if (!isset($_GET['readmore'])) {
$result = dbquery("SELECT * FROM ".$db_prefix."news_cats ORDER BY news_cat_id");
while ($data = dbarray($result)) {
opentable($data['news_cat_name']);
$res = dbquery("SELECT * FROM ".$db_prefix."news WHERE news_cat = '".$data['news_cat_id']."' ORDER BY news_datestamp DESC LIMIT 0,4");
$kom = dbcount("(comment_id)", "comments", "comment_type='N' AND comment_item_id='".$data['news_id']."'");
while ($ndata = dbarray($res)) {
echo "<table width='100%'>
<tr><td valign='top' width='100'>".(verify_image($ndata['news_news']) ? "<img src='".$ndata['news_news']."'>" : "")."</td><td valign='top'><b>".showdate("%d.%m.%Y %H:%M:%S",$ndata['news_datestamp'])." <a href='".FUSION_SELF."?readmore=".$ndata['news_id']."'><b>".$ndata['news_subject']."</b></a></b><br>".parseubb(parsesmileys(stripinput(trimlink($ndata['news_extended'],40))))."<table align='right'><tr><td><a href='".FUSION_SELF."?readmore=".$ndata['news_id']."'><b>skaityti viską ($kom)</b></a></td></tr></table></td></tr>
</table>\n";
}
echo "<a href='".BASEDIR."news_cats.php?cat_id=".$data['news_cat_id']."'><b>Skaityti toliau</b></a><br>\n";
closetable();
tablebreak();
}
} else {
if (!dbcount("(*)","news","news_id = '".$_GET['readmore']."'")) fallback("index.php");
$readmore = $_GET['readmore'];
$result = dbquery("SELECT * FROM ".$db_prefix."news LEFT JOIN ".$db_prefix."users ON news_name = user_id WHERE news_id = '$readmore'");
$data = dbarray($result);
opentable("Naujienos");
echo "<table width='100%'>
<tr><td valign='top'>".(verify_image($data['news_news']) ? "<img src='".$data['news_news']."'>" : "")."</td><td valign='top'><b>".$data['news_subject']."</b>
<br><b>".showdate("%d.%m.%Y %H:%M:%S",$data['news_datestamp'])." - <a href='".BASEDIR."profile.php?lookup=".$data['user_id']."'>".$data['user_name']."</a></b><br><br>".parseubb(parsesmileys(stripinput($data['news_extended'])))."</td></tr>
</table>\n";
include INCLUDES."comments_include.php";
include INCLUDES."ratings_include.php";
closetable();
}
require_once "side_right.php";
require_once "footer.php";
?>
Ačiū
Redagavo DJFainulka· 2009 Sau. 31 20:01:16