Author |
Message |
razor
New Member


Joined: Oct 14, 2005
Posts: 22
|
Posted:
Tue Oct 31, 2006 5:18 am |
|
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 |
|
|
|
 |
gregexp
The Mouse Is Extension Of Arm

Joined: Feb 21, 2006
Posts: 1497
Location: In front of a screen....HELP! lol
|
Posted:
Tue Oct 31, 2006 1:31 pm |
|
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!! |
|
 |
 |
razor

|
Posted:
Tue Oct 31, 2006 5:21 pm |
|
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

|
Posted:
Tue Oct 31, 2006 9:10 pm |
|
Do they need to point to something? Like archives or something, basically, do they need to be linked? |
|
|
|
 |
razor

|
Posted:
Tue Oct 31, 2006 11:17 pm |
|
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

|
Posted:
Tue Oct 31, 2006 11:45 pm |
|
If you go to http://9down.com/index.php on the left they have the block called Stories Archive... thats the block i'm looking for... |
|
|
|
 |
razor

|
Posted:
Thu Nov 09, 2006 1:02 am |
|
lol anyone have any ideas? |
|
|
|
 |
montego
Site Admin

Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Thu Nov 09, 2006 6:34 am |
|
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. |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
 |
razor

|
Posted:
Thu Nov 09, 2006 8:43 pm |
|
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&sa=show_month&year=$year&month=$getdate[2]&month_l=$month\">$month, $year</a>";
$thismonth = $month;
}
}
$content .= "</ul>"
."<br><center>"
."[ <a href=\"modules.php?name=$module_name&sa=show_all\">Show All</a> ]</center>";
?>
|
|
|
|
|
 |
montego

|
Posted:
Fri Nov 10, 2006 6:09 am |
|
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();
}
|
|
|
|
|
 |
|