Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
razor
New Member
New Member



Joined: Oct 14, 2005
Posts: 22

PostPosted: Tue Oct 31, 2006 5:18 am Reply with quote

I'm looking for a block or help creating a block that will display all the months, just like seen in the Stories_Archive module... Ty for any help
 
View user's profile Send private message
gregexp
The Mouse Is Extension Of Arm



Joined: Feb 21, 2006
Posts: 1497
Location: In front of a screen....HELP! lol

PostPosted: Tue Oct 31, 2006 1:31 pm Reply with quote

Display all the months?

Like a block that has:

January
February
.....
November
December

?
I just want to clarify.

_________________
For those who stand shall NEVER fall and those who fall shall RISE once more!! 
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
razor







PostPosted: Tue Oct 31, 2006 5:21 pm Reply with quote

Yeah, should look like this in the block...

* November, 2006
* October, 2006
* September, 2006
* August, 2006
* July, 2006
* June, 2006
* May, 2006
* April, 2006
* March, 2006
* February, 2006
* January, 2006
 
gregexp







PostPosted: Tue Oct 31, 2006 9:10 pm Reply with quote

Do they need to point to something? Like archives or something, basically, do they need to be linked?
 
razor







PostPosted: Tue Oct 31, 2006 11:17 pm Reply with quote

Yeah just like when click Stories Archive in the modules/navigation block, how they show all the months in there... I need the block to link all the news stories to that month just like the stories archive module...
 
razor







PostPosted: Tue Oct 31, 2006 11:45 pm Reply with quote

If you go to [ Only registered users can see links on this board! Get registered or login! ] on the left they have the block called Stories Archive... thats the block i'm looking for...
 
razor







PostPosted: Thu Nov 09, 2006 1:02 am Reply with quote

lol anyone have any ideas?
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Thu Nov 09, 2006 6:34 am Reply with quote

I suggest that you create your own block. Take the block-Old_Articles.php as your example from a block structure standpoint, but use the code from function select_month() within modules/Stories_Archive/index.php.

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
razor







PostPosted: Thu Nov 09, 2006 8:43 pm Reply with quote

Alright this took me a bit but i got it coded to work... anyone else who needs this block heres the code for it... Thanks all for your replies.

Code:
<?php

if (stristr($_SERVER['SCRIPT_NAME'], "block-Stories_Archive.php")) {
    Header("Location: ../index.php");
    die();
}

global $prefix, $user_prefix, $db, $module_name;
   
    $result = $db->sql_query("SELECT time from ".$prefix."_stories order by time DESC");
    $content = "<ul>";
    while($row = $db->sql_fetchrow($result)) {
   $time = $row['time'];
   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, $getdate);
   if ($getdate[2] == "01") { $month = _JANUARY; } elseif ($getdate[2] == "02") { $month = _FEBRUARY; } elseif ($getdate[2] == "03") { $month = _MARCH; } elseif ($getdate[2] == "04") { $month = _APRIL; } elseif ($getdate[2] == "05") { $month = _MAY; } elseif ($getdate[2] == "06") { $month = _JUNE; } elseif ($getdate[2] == "07") { $month = _JULY; } elseif ($getdate[2] == "08") { $month = _AUGUST; } elseif ($getdate[2] == "09") { $month = _SEPTEMBER; } elseif ($getdate[2] == "10") { $month = _OCTOBER; } elseif ($getdate[2] == "11") { $month = _NOVEMBER; } elseif ($getdate[2] == "12") { $month = _DECEMBER; }
   if ($month != $thismonth) {
       $year = $getdate[1];
       $content .= "<li><a href=\"modules.php?name=$module_name&amp;sa=show_month&amp;year=$year&amp;month=$getdate[2]&amp;month_l=$month\">$month, $year</a>";
       $thismonth = $month;
   }
    }
    $content .= "</ul>"
   ."<br><center>"
   ."[ <a href=\"modules.php?name=$module_name&amp;sa=show_all\">Show All</a> ]</center>";

?>
 
montego







PostPosted: Fri Nov 10, 2006 6:09 am Reply with quote

Most excellent!

For those who are using the 3.x patches from Chatserv, you would want to replace this:

Code:


if (stristr($_SERVER['SCRIPT_NAME'], "block-Stories_Archive.php")) {
    Header("Location: ../index.php");
    die();
}


with this:

Code:


if ( !defined('BLOCK_FILE') ) {
   Header('Location: ../index.php');
   die();
}
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
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 can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©