10 most read news last week block

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   10 most read news last week block
stclem
CZ Super Newbie
Age: 46
Gender: Male
Status: Offline
Joined: Sep 09, 2003
0.01 posts per day
Posts: 85
Points: 4,060
   
is there a block who can show the 10 (or 5) most read news the last week?



Back to top Reply with quote
#2   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,440
   
Grab the sql table for the nuke stories and post it I will try to help you make it.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   re: 10 most read news last week block
stclem
CZ Super Newbie
Age: 46
Gender: Male
Status: Offline
Joined: Sep 09, 2003
0.01 posts per day
Posts: 85
Points: 4,060
   
I do not understand what you meen. But i have these two blocks, and i think it have to be posible to merge them. The block named block-lastnews.php is the almost the block i want, but i want it to show the 10 most popular new last week and not the 10 latest news.

The second block is a block who show te 2 most popular news last week, but not in the way i want.

here is the blocks: [ Register or login to view links on this board.]



Back to top Reply with quote
#4   re: 10 most read news last week block
stclem
CZ Super Newbie
Age: 46
Gender: Male
Status: Offline
Joined: Sep 09, 2003
0.01 posts per day
Posts: 85
Points: 4,060
   
I have made it my self..... i dont think its the most beautiful code, but it works that way i want it so i am happy. I post it here so you can see if you want.

<?php
//* Top 2 articles center block RC 1
/************************************************************************/
/* top 2  articles center block for php-nuke 7.x                        */
/*                                                                      */
/*   RC 1                                                               */
/*                                                                      */
/*  First release of block that shows the 2 most read articles the last */
/*  week. Put it as a center block only.                                */
/*                                                                      */
/*  Thanx to Tenshi for beta testing.                                   */
/*                                                                      */
/*  Feel free to modify as long as you credit me                        */
/*                                                                      */
/*  JzKy - [ Register or login to view links on this board. ]                                                */
/*                                                                      */
/*                                                                      */
/*                                                                      */
/*                                                                      */
/*                                                                      */
/************************************************************************/

/************************************************************************/
/* Original from PHP-NUKE: Advanced Content Management System           */
/* ============================================                         */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi (fbc@mandrakesoft.com)         */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/


if (eregi("block-top2-center.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
include('modules/News/functions.php');
include("language/lang-$language.php");
}

$textartic = "Most read last week";                  // 10 most read news last week.


//*require_once("mainfile.php");
$module_name = "News";
get_lang($module_name);
global $storyhome, $language, $httpref, $httprefmax, $topicname, $topicimage, $topictext, $tipath, $datetime, $user, $cookie, $nukeurl, $prefix, $multilingual, $currentlang, $articlecomm, $bgcolor2, $bgcolor4, $datetime;
   $content ="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"tabletable\" width=\"100%\" valign=\"top\" align=\"left\"><tr><td background=\"themes/Tippeliga1/images/punktgra2.gif\" height=\"1\" align=\"left\"></font></td><tr><tr><td width=\"100%\" valign=\"top\"><font class=\"contentblue\">$textartic<br>";
   $coun = 0;
   if ($multilingual == 0) {
       $querylang = "AND (alanguage='$currentlang' OR alanguage='')";
   } else {
       $querylang = "";
   }
    if (isset($cookie[3])) {
   $storynum = $cookie[3];
    } else {
   $storynum = $storyhome;
    }
    $result = mysql_query("SELECT sid, catid, aid, title, time, DATE_ADD(time, INTERVAL 2 DAY), now(), hometext, bodytext, comments, counter, topic, informant, notes, acomm FROM $prefix"._stories." WHERE TO_DAYS(NOW()) - TO_DAYS(time) <= 7 order by counter DESC limit 0,10");
    if(!$result) {
   echo mysql_errno(). ": ".mysql_error(). "<br>"; exit();
    }
   
   
    while (list($s_sid, $catid, $aid, $title, $time, $expire, $now, $hometext, $bodytext, $comments, $counter, $topic, $informant, $notes, $acomm) = mysql_fetch_row($result)) {
   if ($catid > 0) {
       list($cattitle) = mysql_fetch_row(mysql_query("select title from $prefix"._stories."_cat where catid='$catid'"));
       list ($topicimage) = mysql_fetch_(mysql_query("SELECT topicimage FROM ".$prefix."_topics WHERE topicid='$topic'"));
       list ($topictext) = mysql_fetch_a (mysql_query("select hometext FROM ".$prefix."_stories where sid='$sid'"));
      
   
   }
   getTopics($s_sid);
   ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime);
   $datetime = strftime("%d-%m-%Y", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
   $datetime = ucfirst($datetime);
   $subject = stripslashes($subject);
   $hometext = stripslashes($hometext);
   $notes = stripslashes($notes);
   $introcount = strlen($hometext);
   $fullcount = strlen($bodytext);
   $totalcount = $introcount + $fullcount;
   $byteM    = "<a href=\"modules.php?name=News&file=article&sid=$s_sid\"><img src=\"images/menu/bytesmore.gif\" border=0 Alt=\""._BYTESMORE." $fullcount\" ></a>";
        $commentC = "<a href=\"modules.php?name=News&file=article&sid=$s_sid&mode=&order=0&thold=0\"><img src=\"images/menu/comments2.gif\" border=0  Alt=\""._COMMENTS." $comments\" ></a>";
   $senderT  = "<a href=\"modules.php?name=Your_Account&op=userinfo&uname=$informant\">$informant</a>";
   $counterC = "<img src=\"images/menu/counter.gif\" border=0 Alt=\""._READS." $counter\" ></a>";
   $empty    = "<img src=\"images/menu/empty.gif\" border=0 >";
   
   $sid = $s_sid;
   if ($catid != 0) {
       $resultm = mysql_query("select title from $prefix"._stories."_cat where catid='$catid'");
       list($title1) = mysql_fetch_row($resultm);
       $title = "$title <a class =\"storycat\" href=\"modules.php?name=News&file=categories&op=newindex&catid=$catid\">[ $title1 ]</a>";
   }
   if ( $now>$expire ) {$image="sign";} else { $image="new";}
$content .="";
$content .="";
$content .="</a></left>";
$content .="<tr><td><a href=\"modules.php?name=News&file=article&sid=$s_sid\"><font class=\"newsmaax_title\"face=\"Verdana\"><b>- $title</b></font></a><br></td></tr>";

$content .="";
if ($coun == 1) {
   $coun = 0;
    } else {
   $coun++;
    }
}
    mysql_free_result($result);
$content .="</tr></table>";

?>



Back to top Reply with quote
#5   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,440
   
I meant to attach the sql schema and I would help you make it. Glad you got it done and thanks for posting.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum