hjælp med at ændre i news script
Hejsa håber nogen kan hjælpemin hjemmeside er www.woel.frac.dk
hvor jeg har været ved at lave nogle ændringer og opdateringer.
Min news fungerer perfekt!
Ligenu viser jeg de 4 seneste nyheder og med kun 200 bogstaver mener jeg det er.
Men det jeg vil ha lavet er så at den nyeste (seneste( tilføjede nyhed bliver vist i den øverste tabel med hele nyheden.
Det er denne her fil jeg bruger som include når jeg viser nyheder, så var det jeg tænkte om jeg ikke kunne lave en kopi af den og kalde headnews og ændre så at den kun viste den seneste nyhed og helt.
Også ændre den originale så at den viser som nu men bare minus den nyeste ??
Håber i kan hjælpe ^^
<?PHP
include("themes/$theme/head.php");
///////////////////////NEWSLIMIT/////////////////////////
$conn = mysql_connect($mysql_host, $mysql_user, $mysql_password);
$db = mysql_select_db($mysql_db, $conn);
$sql = "SELECT * FROM {$prefix}_style";
$result = mysql_query($sql, $conn);
$table = mysql_fetch_array($result, MYSQL_ASSOC);
$newslimit = $table["newslimit"];
///////////////////////NEWSLIMIT/////////////////////////
//////////////////////////// NEWS //////////////////////////////
$sql = "SELECT * FROM {$prefix}_news ORDER BY id DESC LIMIT 0,$newslimit ";
$result = mysql_query($sql, $conn);
while($data = mysql_fetch_array($result, MYSQL_ASSOC))
{
$commentnumber = "0";
$id = $data["id"];
$commentnumbers = mysql_query("SELECT COUNT(id) FROM {$prefix}_news_comments WHERE news_id = '$id'");
$commentnumber = mysql_result($commentnumbers, 0, "count(id)");
$text = substr($data['text'], 0, 300)."...";
$cat = "$data[cat]";
$cat = "$data[cat]";
$text = str_replace('
', '<br>', $text);
$news_template = "themes/$theme/news.tpl";
$news_output = implode(" ", file($news_template));
$rlink1 = "$data[rlink1]";
$rlink2 = "$data[rlink2]";
if (!empty($rlink1))
{
$news_output = str_replace('{rlinks}', "<br><b>"._RELATED_LINKS.":</b><br>", $news_output);
$news_output = str_replace('{rlink1}', "<b>» </b><a href=http://" . $data["http1"] . " target=_blank>" . $data["rlink1"] . "</a><br>", $news_output);
}
else {
$news_output = str_replace('{rlinks}', "", $news_output);
$news_output = str_replace('{rlink1}', "", $news_output);
$news_output = str_replace('{rlink2}', "", $news_output);
}
if (!empty($rlink2))
{
$news_output = str_replace('{rlink2}', "<b>» </b><a href=http://" . $data["http2"] . " target=_blank>" . $data["rlink2"] . "</a><br>", $news_output);
}
else {
$news_output = str_replace('{rlink2}', "", $news_output);
}
$news_output = str_replace('{read_more}', ""._READ_MORE."", $news_output);
$news_output = str_replace('{header}', $data["header"], $news_output);
$news_output = str_replace('{id}', $data["id"], $news_output);
$news_output = str_replace('{written}', ""._WRITTEN."", $news_output);
$news_output = str_replace('{text}', $text, $news_output);
$news_output = str_replace('{kommlink}', "<a href=index.php?page=news_kommentar&nid=" . $data["id"] . ">"._COMMENT."</a>", $news_output);
$news_output = str_replace('{commentnumber}', $commentnumber, $news_output);
$news_output = str_replace('{user}', "<a href=mailto:" . $data["email"] . ">" . $data["name"] . "</a>", $news_output);
$news_output = str_replace('[quote]', "<table width='70%' cellspacing='1' cellpadding='0' border='0' align='left'><tr><td><b>"._QUOTE.":</b></span></td></tr><tr><td class='quote'>", $news_output);
$news_output = str_replace('[/quote]', "</td></tr></table>", $news_output);
$news_output = str_replace("", "<i>", $news_output);
$news_output = str_replace("", "</i>", $news_output);
$news_output = str_replace("", "<b>", $news_output);
$news_output = str_replace("", "</b>", $news_output);
$news_output = str_replace("", "<u>", $news_output);
$news_output = str_replace("", "</u>", $news_output);
$news_output = str_replace("[n]", "<BR>", $news_output);
$news_output = str_replace("[red]", "<font color='#FF3D3D'>", $news_output);
$news_output = str_replace("[/red]", "</font>", $news_output);
$news_output = str_replace("[green]", "<font color='#99FF99'>", $news_output);
$news_output = str_replace("[/green]", "</font>", $news_output);
$news_output = str_replace("[blue]", "<font color='#6F72FF'>", $news_output);
$news_output = str_replace("[/blue]", "</font>", $news_output);
$news_output = str_replace("[yellow]", "<font color='#FEFF7D'>", $news_output);
$news_output = str_replace("[/yellow]", "</font>", $news_output);
$news_output = str_replace("[black]", "<font color='black'>", $news_output);
$news_output = str_replace("[/black]", "</font>", $news_output);
$news_output = str_replace("[white]", "<font color='white'>", $news_output);
$news_output = str_replace("[/white]", "</font>", $news_output);
$news_output = str_replace("[pink]", "<font color='#FFC0C0'>", $news_output);
$news_output = str_replace("[/pink]", "</font>", $news_output);
$news_output = str_replace("[purple]", "<font color='#FF80FF'>", $news_output);
$news_output = str_replace("[/purple]", "</font>", $news_output);
$news_output = str_replace("[img]", "<IMG src='", $news_output);
$news_output = str_replace("[/img]", "' border=0 >", $news_output);
$news_output = str_replace("[url="","[url=\"", $news_output);
$news_output = str_replace(""]","\"]", $news_output);
$news_output = eregi_replace("\[url=\"([^\"]+)\"]([^\[]+)\[/url\]","<a href=\"\\1\" target='blank'>\\2</a>", $news_output);
$news_output = str_replace('{date}', $data["date"], $news_output);
if ($data[cat] == ""._CATEGORI_1."") {$topic = "<img src=topics/"._CATEGORI_1.".gif valign=top align=right alt="._CATEGORI_1."></a>";}
elseif ($data[cat] == ""._CATEGORI_2."") {$topic = "<img src=topics/"._CATEGORI_2.".gif valign=top align=right alt="._CATEGORI_2.">";}
elseif ($data[cat] == ""._CATEGORI_3."") {$topic = "<img src=topics/"._CATEGORI_3.".gif valign=top align=right alt="._CATEGORI_3.">";}
elseif ($data[cat] == ""._CATEGORI_4."") {$topic = "<img src=topics/"._CATEGORI_4.".gif valign=top align=right alt="._CATEGORI_4.">";}
elseif ($data[cat] == ""._CATEGORI_5."") {$topic = "<img src=topics/"._CATEGORI_5.".gif valign=top align=right alt="._CATEGORI_5.">";}
elseif ($data[cat] == ""._CATEGORI_6."") {$topic = "<img src=topics/"._CATEGORI_6.".gif valign=top align=right alt="._CATEGORI_6.">";}
elseif ($data[cat] == ""._CATEGORI_7."") {$topic = "<img src=topics/"._CATEGORI_7.".gif valign=top align=right alt="._CATEGORI_7.">";}
$news_output = str_replace('{topic}', $topic, $news_output);
echo $news_output;
}
echo "<p align=center><a href=index.php?page=archiv>$menu_pre "._TO_ARCHIVE." $menu_aft</a></p>";
include("themes/$theme/foot.php");
?>