Need help Modifying Big Story of today 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   Need help Modifying Big Story of today block
Rizzen
CZ Newbie
Rizzen has been a member for over 16 year's 16 Year Member
Status: Offline
Joined: Feb 03, 2008
0.00 posts per day
Posts: 16
Points: 10
   
I am a php noob. And cant figure this one out.

Basically I want the Big Story of Today block to display all stories posted not just the stories posted that day. What do I need to change in the code to allow me to do this.

Thanks in advance for any help.



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
   
Can you post the PHP code in the block file please.




_________________
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: Need help Modifying Big Story of today block
Rizzen
CZ Newbie
Rizzen has been a member for over 16 year's 16 Year Member
Status: Offline
Joined: Feb 03, 2008
0.00 posts per day
Posts: 16
Points: 10
   

<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2006 by Francisco Burzi                                */
/* 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 ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}

global $cookie, $prefix, $multilingual, $currentlang, $db, $user, $userinfo;

if ($multilingual == 1) {
    $querylang = "AND (alanguage='$currentlang' OR alanguage='')"; /* the OR is needed to display stories who are posted to ALL languages */
} else {
    $querylang = "";
}

$today = getdate();
$day = $today['mday'];
if ($day < 10) {
    $day = "0$day";
}
$month = $today['mon'];
if ($month < 10) {
    $month = "0$month";
}
$year = $today['year'];
$tdate = "$year-$month-$day";
$row = $db->sql_fetchrow($db->sql_query("SELECT sid, title FROM ".$prefix."_stories WHERE (time LIKE '%$tdate%') $querylang ORDER BY counter DESC LIMIT 0,1"));
$fsid = intval($row['sid']);
$ftitle = filter($row['title'], "nohtml");
$content = "<span class=\"content\">";
if ((!$fsid) AND (!$ftitle)) {
    $content .= ""._NOBIGSTORY."</font>";
} else {
    $content .= ""._BIGSTORY."<br><br>";
    getusrinfo($user);
          if (!isset($mode) OR empty($mode)) {
            if(isset($userinfo['umode'])) {
              $mode = $userinfo['umode'];
            } else {
              $mode = "thread";
            }
          }
          if (!isset($order) OR empty($order)) {
            if(isset($userinfo['uorder'])) {
              $order = $userinfo['uorder'];
            } else {
              $order = 0;
            }
          }
          if (!isset($thold) OR empty($thold)) {
            if(isset($userinfo['thold'])) {
              $thold = $userinfo['thold'];
            } else {
              $thold = 0;
            }
          }
    $r_options = "";
    $r_options .= "&amp;mode=".$mode;
    $r_options .= "&amp;order=".$order;
    $r_options .= "&amp;thold=".$thold;

    $content .= "<a href=\"modules.php?name=News&file=article&sid=$fsid$r_options\">$ftitle</a></span>";
}

?>



Back to top Reply with quote
#4   
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
   
Change this section from this:


if ($multilingual == 1) {
    $querylang = "AND (alanguage='$currentlang' OR alanguage='')"; /* the OR is needed to display stories who are posted to ALL languages */
} else {
    $querylang = "";
}


To this:


$querylang = ($multilingual == 1) ? "WHERE (alanguage='$currentlang' OR alanguage='')" : "";



And change this line:


$row = $db->sql_fetchrow($db->sql_query("SELECT sid, title FROM ".$prefix."_stories WHERE (time LIKE '%$tdate%') $querylang ORDER BY counter DESC LIMIT 0,1"));


To this:


$row = $db->sql_fetchrow($db->sql_query("SELECT sid, title FROM ".$prefix."_stories $querylang ORDER BY counter DESC LIMIT 0, 10"));


You can change the 10 to any number of stories you want it to show. So if you want 100 stories to show then change it to 100. icon_smile.gif



_________________
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
#5   re: Need help Modifying Big Story of today block
Rizzen
CZ Newbie
Rizzen has been a member for over 16 year's 16 Year Member
Status: Offline
Joined: Feb 03, 2008
0.00 posts per day
Posts: 16
Points: 10
   
Thanks for the help. icon_smile.gif It almost worked. It did display an older story however, it is only displaying one story. Currently I have two stries posted. Before only the story with todays dat would display. Now, the story with the older date is displaying but not the story with todays date.



Back to top Reply with quote
#6   
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
   
Paste the PHP code after you made your changes.




_________________
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
#7   re: Need help Modifying Big Story of today block
Rizzen
CZ Newbie
Rizzen has been a member for over 16 year's 16 Year Member
Status: Offline
Joined: Feb 03, 2008
0.00 posts per day
Posts: 16
Points: 10
   

<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2006 by Francisco Burzi                                */
/* 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 ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}

global $cookie, $prefix, $multilingual, $currentlang, $db, $user, $userinfo;

$querylang = ($multilingual == 1) ? "WHERE (alanguage='$currentlang' OR alanguage='')" : "";

$today = getdate();
$day = $today['mday'];
if ($day < 10) {
    $day = "0$day";
}
$month = $today['mon'];
if ($month < 10) {
    $month = "0$month";
}
$year = $today['year'];
$tdate = "$year-$month-$day";
$row = $db->sql_fetchrow($db->sql_query("SELECT sid, title FROM ".$prefix."_stories $querylang ORDER BY counter DESC LIMIT 0,10"));
$fsid = intval($row['sid']);
$ftitle = filter($row['title'], "nohtml");
$content = "<span class=\"content\">";
if ((!$fsid) AND (!$ftitle)) {
    $content .= ""._NOBIGSTORY."</font>";
} else {
    $content .= ""._BIGSTORY."<br><br>";
    getusrinfo($user);
          if (!isset($mode) OR empty($mode)) {
            if(isset($userinfo['umode'])) {
              $mode = $userinfo['umode'];
            } else {
              $mode = "thread";
            }
          }
          if (!isset($order) OR empty($order)) {
            if(isset($userinfo['uorder'])) {
              $order = $userinfo['uorder'];
            } else {
              $order = 0;
            }
          }
          if (!isset($thold) OR empty($thold)) {
            if(isset($userinfo['thold'])) {
              $thold = $userinfo['thold'];
            } else {
              $thold = 0;
            }
          }
    $r_options = "";
    $r_options .= "&amp;mode=".$mode;
    $r_options .= "&amp;order=".$order;
    $r_options .= "&amp;thold=".$thold;

    $content .= "<a href=\"modules.php?name=News&file=article&sid=$fsid$r_options\">$ftitle</a></span>";
}

?>



Back to top Reply with quote
#8   
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
   
Here ya go.


<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2006 by Francisco Burzi                                */
/* 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 ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}

global $cookie, $prefix, $multilingual, $currentlang, $db, $user, $userinfo;

$querylang = ($multilingual == 1) ? "WHERE (alanguage='$currentlang' OR alanguage='')" : "";

$content = "<span class=\"content\">"._BIGSTORY."<br /><br />\n";

$result = $db->sql_query("SELECT sid, title FROM ".$prefix."_stories $querylang ORDER BY counter DESC LIMIT 0,10");

if ($db->sql_numrows($result) > 0) {

   while ($row = $db->sql_fetchrow($result)) {
      $fsid = intval($row['sid']);
      $ftitle = filter($row['title'], "nohtml");
          getusrinfo($user);
             if (!isset($mode) OR empty($mode)) {
               if(isset($userinfo['umode'])) {
                    $mode = $userinfo['umode'];
               } else {
                    $mode = "thread";
               }
          }
          if (!isset($order) OR empty($order)) {
               if(isset($userinfo['uorder'])) {
                    $order = $userinfo['uorder'];
               } else {
                    $order = 0;
               }
          }
          if (!isset($thold) OR empty($thold)) {
               if(isset($userinfo['thold'])) {
                    $thold = $userinfo['thold'];
               } else {
                    $thold = 0;
               }
          }
          $r_options = "";
          $r_options .= "&amp;mode=".$mode;
          $r_options .= "&amp;order=".$order;
          $r_options .= "&amp;thold=".$thold;

          $content .= "<a href=\"modules.php?name=News&file=article&sid=$fsid$r_options\">$ftitle</a>";
   }
   $db->sql_freeresult($result);
} else {
          $content .= _NOBIGSTORY;
}
   $content .= "</span>";
?>




_________________
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
#9   re: Need help Modifying Big Story of today block
Rizzen
CZ Newbie
Rizzen has been a member for over 16 year's 16 Year Member
Status: Offline
Joined: Feb 03, 2008
0.00 posts per day
Posts: 16
Points: 10
   
sorry for the late reply I was tied up all day yesterday but I am back at it today.

I copied your post exactly, and it is still only displaying one story. However this time its with todays date, even though judging by the code date isnt a factor anymore.



Back to top Reply with quote
#10   
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 edited the one above some. Please try it now. Make sure that you have more then one story in the database also.




_________________
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