Har fået fat i revideret news_archive.php og det ser ud til at det kører som det skal, ved ikke om dit forslag også ville virke, men løst lidt anderledes
http://www.findholger.1go.dk/fusion_infusions/news_archive/news_archive.ph p?year=2005&month=April
Vedhæfter lige hele koden der virker
Kode:
<?
/*--------------------------------------------+
| PHP-Fusion 5 - Content Management System |
|---------------------------------------------|
| author: Nick Jones (Digitanium) © 2002-2005 |
| web:
http://www.php-fusion.co.uk |
| email: nick@php-fusion.co.uk |
|---------------------------------------------|
| Released under the terms and conditions of |
| the GNU General Public License (Version 2) |
+--------------------------------------------*/
@require_once "../../fusion_config.php";
require_once "../../fusion_core.php";
require_once "../../subheader.php";
require_once "../../side_left.php";
@include FUSION_INFUSIONS."news_archive/lang/".$settings['language'].".php";
@include FUSION_INFUSIONS."news_archive/lang/English.php";
$nas = dbarray(dbquery("SELECT * FROM ".$fusion_prefix."nas"));
$array_month = array(Januar,Februar,Marts,April,Maj,Juni,Juli,August,September,Oktober,November,December);
$newsorder = $nas[news_order];
$numofnews = $nas[numofnews];
if ($nas[listexp] == 1){
$listexp = "AND (news_end='0'||news_end>=".time().")";
}else{
$listexp = "";
}
function listnews($var){
global $rows, $fusion_prefix, $rowstart, $listexp, $numofnews, $year, $month, $day, $PHP_SELF;
if ($rows !=0){
echo "<br><table align='center' cellspacing='0' cellpadding='0' border='0' width='100%' class='tbl-border'>
<tr>
<td>";
echo "<table align='center' cellpadding='0' cellspacing='1' width='100%' border='0'>";
echo "<tr><td align='center' width='50%' class='tbl2'><b>".NA_011."</b></td><td align='center' class='tbl2'><b>".NA_012."</b></td>
<td align='center' class='tbl2'><b>".NA_013."</b></td><td align='center' class='tbl2'><b>".NA_002."</b></td></tr>";
for ($i=$rowstart;$var[$i];$i++) {
$result2 = dbquery(
"SELECT tn.*, tu.user_id,user_name
FROM ".$fusion_prefix."news tn
LEFT JOIN ".$fusion_prefix."users tu ON tn.news_name=tu.user_id
WHERE news_id=$var[$i] AND (news_start='0'||news_start<=".time().") $listexp
GROUP BY news_id ORDER BY news_datestamp ASC"
);
$data = dbarray($result2);
echo "<tr><td align='left' width='50%' class='tbl1'><a href='".FUSION_BASE."news.php?readmore=$var[$i]'>".$data['news_subject']."</a></td>
<td align='center' class='tbl2'><a href='".FUSION_BASE."profile.php?lookup=".$data['user_id']."'>".$data['user_name']."</a></td>
<td align='center' class='tbl1'>".date('d.m.Y', $data[news_datestamp])."</td>
<td align='center' class='tbl2'>".$data['news_reads']."</td></tr>";
if ($i == $rowstart + ($numofnews - 1)){
break;
}
}
echo "</table></td></tr></table>";
}else{
echo "<center><br>".NA_014."<br><br></center>\n";
}
}
opentable(NA_001);
$splityears = array();
$result = dbquery("SELECT * FROM ".$fusion_prefix."news ORDER BY news_datestamp ASC");
if (dbrows($result)!=0) {
while ($date = dbarray($result)){
$allyears = date('Y', $date[news_datestamp]);
array_push($splityears, $allyears);
}
$yearsnum = array_count_values($splityears);
$years = array_unique($splityears);
$years = array_merge($years);
echo ". <a href='news_archive.php?listtype=last&pre=3'>".NA_005."</a><br>";
echo ". <a href='news_archive.php?listtype=last&pre=7'>".NA_006."</a><br>";
echo ". <a href='news_archive.php?listtype=last&pre=30'>".NA_008."</a><br>";
echo "<hr>";
for ($i=0;$years[$i];$i++) {
echo ". <a href='news_archive.php?year=$years[$i]'>$years[$i]</a> (".$yearsnum[$years[$i]].")<br>";
}
closetable();
if ($listtype == "last"){
tablebreak();
opentable(NA_010);
$newslastweek = array();
$result = dbquery("SELECT * FROM ".$fusion_prefix."news ORDER BY news_datestamp $newsorder");
if (!$rowstart) $rowstart = 0;
if (!$pre) $pre = 7;
$weektime = mktime(0, 0, 0, date("m") , date("d")-$pre, date("Y"));
while ($date = dbarray($result)){
$newstime = $date[news_datestamp];
if ($newstime >= $weektime){
$newsid = $date[news_id];
array_push($newslastweek, $newsid);
}
}
$rows = count($newslastweek);
listnews($newslastweek);
echo "<br /><div align='center' style='margin-top:5px;'>\n".makePageNav($rowstart,$numofnews,$rows,3,"$PHP_SELF?listtype=last&pre=$pre&")."\n</div>\n";
closetable();
}elseif (isset($year)){
tablebreak();
opentable($year);
$splitmonths = array();
$result = dbquery("SELECT * FROM ".$fusion_prefix."news ORDER BY news_datestamp ASC");
while ($date = dbarray($result)){
$allyears = date('Y', $date[news_datestamp]);
if ($allyears == $year){
$allmonths = date('F', $date[news_datestamp]);
array_push($splitmonths, $allmonths);
array_push($array_month, $allmonts);
}
}
$monthsnum = array_count_values($splitmonths);
$months = array_unique($splitmonths);
$months = array_merge($months);
$rows = count($months);
$FIX = array (
'January' => 'Januar',
'February' => 'Februar',
'March' => 'Marts',
'April' => 'April',
'May' => 'Maj',
'June' => 'Juni',
'July' => 'Juli',
'August' => 'August',
'September' => 'September',
'October' => 'Oktober',
'November' => 'November',
'December' => 'December'
);
if ($rows !=0){
for ($i=0;$months[$i];$i++) {
$FIXmonth=$FIX[$months[$i]];
echo ". <a href='news_archive.php?year=$year&month=$months[$i]'>$FIXmonth</a> (".$monthsnum[$months[$i]].") - (<a href='news_archive.php?listtype=bymonth&year=$year&month=$months[$i]'>".NA _004."</a>)<br>";
}
}else{
echo "<center><br>".NA_015."<br><br></center>\n";
}
closetable();
if ($listtype == "bymonth"){
tablebreak();
if ($month == "January") {
$month_t = "Januar";
}
if ($month == "February") {
$month_t = "Februar";
}
if ($month == "March") {
$month_t = "Marts";
}
if ($month == "April") {
$month_t = "April";
}
if ($month == "May") {
$month_t = "Maj";
}
if ($month == "June") {
$month_t = "Juni";
}
if ($month == "July") {
$month_t = "Juli";
}
if ($month == "August") {
$month_t = "August";
}
if ($month == "September") {
$month_t = "September";
}
if ($month == "October") {
$month_t = "Oktober";
}
if ($month == "November") {
$month_t = "November";
}
if ($month == "December") {
$month_t = "December";
}
opentable($month_t);
$newsbymonth = array();
$result = dbquery("SELECT * FROM ".$fusion_prefix."news ORDER BY news_datestamp $newsorder");
if (!$rowstart) $rowstart = 0;
while ($date = dbarray($result)){
$allyears = date('Y', $date[news_datestamp]);
$allmonths = date('F', $date[news_datestamp]);
if ($allmonths == $month && $allyears == $year){
$newsid = $date[news_id];
array_push($newsbymonth, $newsid);
}
}
$rows = count($newsbymonth);
listnews($newsbymonth);
echo "<br /><div align='center' style='margin-top:5px;'>\n".makePageNav($rowstart,$numofnews,$rows,3,"$PHP_SELF?listtype=bymonth&year=$year&month=$month&")."\n</div>\n";
closetable();
}elseif (isset($month)){
tablebreak();
//den nederste månedsrubrik
if ($month == "January") {
$month_t = "Januar";
}
if ($month == "February") {
$month_t = "Februar";
}
if ($month == "March") {
$month_t = "Marts";
}
if ($month == "April") {
$month_t = "April";
}
if ($month == "May") {
$month_t = "Maj";
}
if ($month == "June") {
$month_t = "Juni";
}
if ($month == "July") {
$month_t = "Juli";
}
if ($month == "August") {
$month_t = "August";
}
if ($month == "September") {
$month_t = "September";
}
if ($month == "October") {
$month_t = "Oktober";
}
if ($month == "November") {
$month_t = "November";
}
if ($month == "December") {
$month_t = "December";
}
opentable($month_t);
$splitdays = array();
$result = dbquery("SELECT * FROM ".$fusion_prefix."news ORDER BY news_datestamp ASC");
while ($date = dbarray($result)){
$allyears = date('Y', $date[news_datestamp]);
$allmonths = date('F', $date[news_datestamp]);
if ($allmonths == $month && $allyears == $year){
$alldays = date('d', $date[news_datestamp]);
array_push($splitdays, $alldays);
}
}
$daysnum = array_count_values($splitdays);
$days = array_unique($splitdays);
$days = array_merge($days);
$rows = count($days);
if ($rows !=0){
for ($i=0;$days[$i];$i++) {
if ( $days[$i] == 1 or $days[$i] == 21 or $days[$i] == 31){
$sub = "Nyheder den: ";
}elseif ( $days[$i] == 2 or $days[$i] == 22){
$sub = "Nyheder den: ";
}elseif ( $days[$i] == 3 or $days[$i] == 23){
$sub = "Nyheder den: ";
}else{
$sub = "Nyheder den: ";
}
echo ". <a href='news_archive.php?year=$year&month=$month&day=$days[$i]'>$sub$days[$i]</a> (".$daysnum[$days[$i]].")<br>";
}
}else{
echo "<center><br>".NA_009."<br><br></center>\n";
}
closetable();
}
if (isset($day)){
tablebreak();
opentable("Nyheder den: ".$day);
$news = array();
$result = dbquery("SELECT * FROM ".$fusion_prefix."news ORDER BY news_datestamp $newsorder");
if (!$rowstart) $rowstart = 0;
while ($date = dbarray($result)){
$allyears = date('Y', $date[news_datestamp]);
$allmonths = date('F', $date[news_datestamp]);
$alldays = date('d', $date[news_datestamp]);
if ($alldays == $day && $allmonths == $month && $allyears == $year){
$newsid = $date[news_id];
array_push($news, $newsid);
}
}
$rows = count($news);
listnews($news);
echo "<br /><div align='center' style='margin-top:5px;'>\n".makePageNav($rowstart,$numofnews,$rows,3,"$PHP_SELF?listtype=bymonth&year=$year&month=$month&day=$day&")."\n</div>\n";
closetable();
}
}
}
else
{
echo "<center><br>".NA_003."<br><br></center>\n";
closetable();
}
include FUSION_BASE."side_right.php";
include FUSION_BASE."footer.php";
?>