Author |
Message |
rogue3
Regular


Joined: Jul 02, 2009
Posts: 71
|
Posted:
Mon Jul 06, 2009 8:05 pm |
|
Hello all!
I would like to have a second Stories Archive module. In this one, I'd like the archive to be laid out just like the front page, except you see the entire month instead of the latest articles.
I currently do this manually by copying the front page code. Here is one of my current archive pages:
http://www.jeditemplearchives.com/archives/archives2008-12.shtml
I would like this to auto-generate to make my life much easier. I still want to keep the original stories archive and just have two formats to choose from. |
|
|
|
 |
Raven
Site Admin/Owner

Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Sun Jul 12, 2009 11:34 pm |
|
|
|
 |
rogue3

|
Posted:
Mon Sep 14, 2009 4:43 pm |
|
Any chance anyone's had a chance to ponder this? I really think it would be a great module once it is made. I think it would be a merge of the news and archives module. But, I think it's beyond my scope to create this. |
|
|
|
 |
Raven

|
Posted:
Mon Sep 14, 2009 5:35 pm |
|
If you would like I could move this thread to the For Hire section. |
|
|
|
 |
nuken
RavenNuke(tm) Development Team

Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina
|
Posted:
Mon Sep 14, 2009 6:14 pm |
|
I have something I have been planning for the archives module. It will be a box over for the story title. When you mouse over it, it will display the article in a box. It is not quite what you were talking about, but it is similar. |
_________________ Only registered users can see links on this board! Get registered or login! |
|
|
 |
rogue3

|
Posted:
Mon Sep 14, 2009 7:32 pm |
|
That does sound like an improvement on the current archives module. I'd definately use it. As it is, I still plan on using both archives modules since they both offer very useful formats. |
|
|
|
 |
nuken

|
Posted:
Tue Sep 15, 2009 8:16 am |
|
Here's an example of what I had done a few months ago Only registered users can see links on this board! Get registered or login!. Just mouse over the title. I plan of finishing it up eventually, I just don't know when. |
|
|
|
 |
rogue3

|
Posted:
Tue Sep 15, 2009 8:44 am |
|
That's not a bad alternative. I was looking at the index file for the news archives and it looks like maybe if I can edit what happens after you click on the 'month' you want to see I might be able to do this fairly easily. The function 'show month' seems to be where I would edit. My question is how does the front page news call your theme file 'story_home.html'. I think this is the key. If can get it to do that then I don't see why I wouldn't be able to change the echo code to pull up the full front page text instead of just the headline. |
|
|
|
 |
nuken

|
Posted:
Tue Sep 15, 2009 9:23 am |
|
Here is the show month function from the archives index.php that has the home text added below the title link. You should be able to compare it to the news index.php and make it look like you want it to.
Code:function show_month($year, $month, $month_l) {
global $userinfo, $prefix, $user_prefix, $db, $bgcolor1, $bgcolor2, $user, $cookie, $sitename, $multilingual, $language, $module_name, $articlecomm;
$year = intval($year);
$month = htmlentities($month);
$month_l = htmlentities($month_l);
include_once 'header.php';
automated_news();
title(_STORIESARCHIVE);
title($sitename . ': ' . $month_l . ' ' . $year);
OpenTable();
echo '<table border="0" width="100%"><tr>'
. '<td bgcolor="' . $bgcolor2 . '" align="left"><b>' . _ARTICLES . '</b></td>'
. '<td bgcolor="' . $bgcolor2 . '" align="center"><b>' . _COMMENTS . '</b></td>'
. '<td bgcolor="' . $bgcolor2 . '" align="center"><b>' . _READS . '</b></td>'
. '<td bgcolor="' . $bgcolor2 . '" align="center"><b>' . _USCORE . '</b></td>'
. '<td bgcolor="' . $bgcolor2 . '" align="center"><b>' . _DATE . '</b></td>'
. '<td bgcolor="' . $bgcolor2 . '" align="center"><b>' . _ACTIONS . '</b></td></tr>';
$result = $db->sql_query('SELECT sid, catid, title, hometext, time, comments, counter, topic, alanguage, score, ratings from '.$prefix.'_stories WHERE time >= \''.$year.'-'.$month.'-01 00:00:00\' AND time <= \''.$year.'-'.$month.'-31 23:59:59\' order by sid DESC');
while ($row = $db->sql_fetchrow($result)) {
$sid = intval($row['sid']);
$catid = intval($row['catid']);
$title = stripslashes(check_html($row['title'], 'nohtml'));
$hometext = stripslashes($row['hometext']);
$time = $row['time'];
$comments = stripslashes($row['comments']);
$counter = intval($row['counter']);
$topic = intval($row['topic']);
$alanguage = $row['alanguage'];
$score = intval($row['score']);
$ratings = intval($row['ratings']);
$time = explode(' ', $time);
$actions = '<a href="modules.php?name=News&file=print&sid=' . $sid . '"><img src="images/print.gif" border="0" alt="' . _PRINTER . '" title="' . _PRINTER . '" width="16" height="11" /></a> <a href="modules.php?name=News&file=friend&op=FriendSend&sid=' . $sid . '"><img src="images/friend.gif" border="0" alt="' . _FRIEND . '" title="' . _FRIEND . '" width="16" height="11" /></a>';
if ($score != 0) {
$rated = substr($score/$ratings, 0, 4);
} else {
$rated = 0;
}
if ($catid == 0) {
$title = '<a href="modules.php?name=News&file=article&sid=' . $sid . '">' . $title . '</a><br />'.$hometext.'<hr /><br /><br />';
} elseif ($catid != 0) {
$row_res = $db->sql_fetchrow($db->sql_query('SELECT title from ' . $prefix . '_stories_cat where catid=\'' . $catid . '\''));
$cat_title = $row_res['title'];
$title = '<a href="modules.php?name=News&file=categories&op=newindex&catid=' . $catid . '"><i>' . $cat_title . '</i></a>: <a href="modules.php?name=News&file=article&sid=' . $sid . '">' . $title . '</a>';
}
if ($multilingual == 1) {
if (empty($alanguage)) {
$alanguage = $language;
}
$alt_language = ucfirst($alanguage);
$lang_img = '<img src="images/language/flag-' . $alanguage . '.png" border="0" hspace="2" alt="' . $alt_language . '" title="' . $alt_language . '" />';
} else {
$lang_img = '<strong><big><b>·</b></big></strong>';
}
if ($articlecomm == 0) {
$comments = 0;
}
echo '<tr>'
. '<td bgcolor="' . $bgcolor1 . '" align="left">' . $lang_img . ' ' . $title . '</td>'
. '<td bgcolor="' . $bgcolor1 . '" align="center">' . $comments . '</td>'
. '<td bgcolor="' . $bgcolor1 . '" align="center">' . $counter . '</td>'
. '<td bgcolor="' . $bgcolor1 . '" align="center">' . $rated . '</td>'
. '<td bgcolor="' . $bgcolor1 . '" align="center">' . $time[0] . '</td>'
. '<td bgcolor="' . $bgcolor1 . '" align="center">' . $actions . '</td></tr>';
}
echo '</table>'
. '<br /><br /><br /><hr size="1" noshade="noshade" />'
. '<font class="content"><b>' . _SELECTMONTH2VIEW . '</b></font><br />';
$result2 = $db->sql_query('SELECT time from ' . $prefix . '_stories order by time DESC');
echo '<ul>';
$thismonth = '';
while ($row2 = $db->sql_fetchrow($result2)) {
$time = $row2['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];
echo '<li><a href="modules.php?name=' . $module_name . '&sa=show_month&year=' . $year . '&month=' . $getdate[2] . '&month_l=' . $month . '">' . $month . ', ' . $year . '</a></li>';
$thismonth = $month;
}
}
echo '</ul><br /><br /><center>'
. '<form action="modules.php?name=Search" method="post">'
. '<input type="text" name="query" size="30" /> '
. '<input type="submit" value="' . _SEARCH . '" />'
. '</form>'
. '[ <a href="modules.php?name=' . $module_name . '">' . _ARCHIVESINDEX . '</a> | <a href="modules.php?name=' . $module_name . '&sa=show_all">' . _SHOWALLSTORIES . '</a> ]</center>';
CloseTable();
include_once 'footer.php';
|
|
|
|
|
 |
rogue3

|
Posted:
Tue Sep 15, 2009 10:02 am |
|
I will play around with this the first chance I get. Thanks for the tip! |
|
|
|
 |
rogue3

|
Posted:
Wed Sep 16, 2009 8:26 am |
|
Well your tips paid off! I was able to modify the stories_archive module and create a new one (archives). I've got it about 98% where I want it. The only stumble I've run into is getting the 'morelink' to show up. For some reason it does not. Here's my function so far:
Code:function show_month($year, $month, $month_l) {
global $storyhome, $topicname, $topictext, $datetime, $nukeurl, $userinfo, $prefix, $user_prefix, $db, $bgcolor1, $bgcolor2, $user, $user_news, $cookie, $sitename, $multilingual, $language, $module_name, $articlecomm;
$year = intval($year);
$month = htmlentities($month);
$month_l = htmlentities($month_l);
include_once 'header.php';
automated_news();
// title(_STORIESARCHIVE);
echo "<br><center><img src=\"/images/newsarchiveheader.jpg\" width=\"300\" height=\"50\" /><center><br>";
echo "<font size=5 face=\"arial\" color=\"#3F536E\">$month_l $year<br>";
echo "<img src=\"/images/spacer.gif\" width=\"15\" height=\"10\">";
// title($month_l . ' ' . $year);
echo "<table align=center width=477 cellspacing=0 cellpadding=2 border=0><tr><td bgcolor=\"#ffffff\" valign=\"top\">";
$result = $db->sql_query('SELECT sid, catid, title, hometext, time, comments, counter, topic, alanguage, score, ratings from '.$prefix.'_stories WHERE time >= \''.$year.'-'.$month.'-01 00:00:00\' AND time <= \''.$year.'-'.$month.'-31 23:59:59\' order by sid DESC');
while ($row = $db->sql_fetchrow($result)) {
$sid = intval($row['sid']);
$s_sid = intval($row['sid']);
$aid = stripslashes($row['aid']);
$catid = intval($row['catid']);
$title = stripslashes(check_html($row['title'], 'nohtml'));
$hometext = stripslashes($row['hometext']);
$bodytext = stripslashes($row['bodytext']);
$time = $row['time'];
$comments = stripslashes($row['comments']);
$counter = intval($row['counter']);
$topic = intval($row['topic']);
$informant = stripslashes($row['informant']);
$alanguage = $row['alanguage'];
$score = intval($row['score']);
$ratings = intval($row['ratings']);
formatTimestamp($time);
$subject = stripslashes(check_html($subject, "nohtml"));
$introcount = strlen($hometext);
$fullcount = strlen($bodytext);
$totalcount = $introcount + $fullcount;
// $time = explode(' ', $time);
// $actions = '<a href="modules.php?name=News&file=print&sid=' . $sid . '"><img src="images/print.gif" border="0" alt="' . _PRINTER . '" title="' . _PRINTER . '" width="16" height="11" /></a> <a href="modules.php?name=News&file=friend&op=FriendSend&sid=' . $sid . '"><img src="images/friend.gif" border="0" alt="' . _FRIEND . '" title="' . _FRIEND . '" width="16" height="11" /></a>';
if ($score != 0) {
$rated = substr($score/$ratings, 0, 4);
} else {
$rated = 0;
}
if ($catid == 0) {
$story_link = "<a href=\"/content/modules.php?name=News&file=article&sid=$s_sid$r_options\">";
$morelink = "";
// if ($fullcount > 0 OR $c_count > 0 OR $articlecomm == 0 OR $acomm == 1) {
if ($fullcount > 0 ) {
$morelink .= "$story_link<b>"._READMORE."</b></a>";
} else {
$morelink .= "";
}
if ($fullcount > 0) { $morelink .= ""; }
if ($articlecomm == 1 AND $acomm == 0) {
if ($c_count == 0) { $morelink .= "$story_link"._COMMENTSQ."</a>"; } elseif ($c_count == 1) { $morelink .= "$story_link$c_count "._COMMENT."</a>"; } elseif ($c_count > 1) { $morelink .= "$story_link$c_count "._COMMENTS."</a>"; }
}
$sid = intval($s_sid);
if ($catid != 0) {
$row3 = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_stories_cat WHERE catid='$catid'"));
$title1 = stripslashes(check_html($row3['title'], "nohtml"));
$title = "<a href=\"modules.php?name=News&file=categories&op=newindex&catid=$catid\"><font class=\"storycat\">$title1</font></a>: $story_link $title";
$morelink .= " | <a href=\"modules.php?name=News&file=categories&op=newindex&catid=$catid\">$title1</a>";
}
if ($score != 0) {
$rated = substr($score / $ratings, 0, 4);
} else {
$rated = 0;
}
$morelink .= "";
$morelink = str_replace(" | | ", " | ", $morelink);
if ($catid == 0){
$title = "$story_link<b>$title</b></a>";
}
themeindex($aid, $informant, $datetime, $title, $counter, $topic, $hometext, $notes, $morelink, $topicname, $topicimage, $topictext);
} elseif ($catid != 0) {
$row_res = $db->sql_fetchrow($db->sql_query('SELECT title from ' . $prefix . '_stories_cat where catid=\'' . $catid . '\''));
$cat_title = $row_res['title'];
$title = '<a href="modules.php?name=News&file=categories&op=newindex&catid=' . $catid . '"><i>' . $cat_title . '</i></a>: <a href="modules.php?name=News&file=article&sid=' . $sid . '">' . $title . '</a>';
}
if ($multilingual == 1) {
if (empty($alanguage)) {
$alanguage = $language;
}
$alt_language = ucfirst($alanguage);
$lang_img = '<img src="images/language/flag-' . $alanguage . '.png" border="0" hspace="2" alt="' . $alt_language . '" title="' . $alt_language . '" />';
} else {
$lang_img = '<strong><big><b>·</b></big></strong>';
}
if ($articlecomm == 0) {
$comments = 0;
}
}
$result2 = $db->sql_query('SELECT time from ' . $prefix . '_stories order by time DESC');
$thismonth = '';
while ($row2 = $db->sql_fetchrow($result2)) {
$time = $row2['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];
$thismonth = $month;
}
}
echo '</ul><br /><center>'
. '<form action="modules.php?name=Search" method="post">'
. '<input type="text" name="query" size="30" /> '
. '<input type="submit" value="News Search" />'
. '</form>'
. '<font size="2" face="Arial, Helvetica"><a href="modules.php?name=' . $module_name . '">' . _ARCHIVESINDEX . '</a> | <a href="modules.php?name=' . $module_name . '&sa=show_all">' . _SHOWALLSTORIES . '</a></center></font><br><br>';
}
|
In action:
http://www.jeditemplearchives.com/content/modules.php?name=Archives&sa=show_month&year=2009&month=09&month_l=September |
|
|
|
 |
rogue3

|
Posted:
Thu Sep 17, 2009 8:12 am |
|
OK, I'm down to only two bugs I'm trying to fix.
1. My author is not coming up. It says "Posted by" and then it's blank
2. The 'morelink' is not showing up.
I've tried to figure out what is missing that it is not calling these two bits of data, but I can't figure it out. I've compared it to the news index but I'm not seeing what I'm missing. |
|
|
|
 |
Palbin
Site Admin

Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania
|
Posted:
Thu Sep 17, 2009 8:56 am |
|
One problem I see is that in you SQL statement you are no longer slecting the aid and informant.
Code:
$result = $db->sql_query('SELECT sid, catid, title, hometext, time, comments, counter, topic, alanguage, score, ratings from '.$prefix.'_stories WHERE time >= \''.$year.'-'.$month.'-01 00:00:00\' AND time <= \''.$year.'-'.$month.'-31 23:59:59\' order by sid DESC');
|
Code:
$sid = intval($row['sid']);
$s_sid = intval($row['sid']);
$aid = stripslashes($row['aid']);
$catid = intval($row['catid']);
$title = stripslashes(check_html($row['title'], 'nohtml'));
$hometext = stripslashes($row['hometext']);
$bodytext = stripslashes($row['bodytext']);
$time = $row['time'];
$comments = stripslashes($row['comments']);
$counter = intval($row['counter']);
$topic = intval($row['topic']);
$informant = stripslashes($row['informant']);
$alanguage = $row['alanguage'];
$score = intval($row['score']);
$ratings = intval($row['ratings'])
|
If you fix that that should take care of your posted by problem.
The only thing I can say about your "morelink" is you need to check your if statements. Without testing i can't tell you exactly what is wrong. |
_________________ "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. |
|
|
 |
rogue3

|
Posted:
Thu Sep 17, 2009 9:07 am |
|
Good catch. I missed that. The 'posted by' problem is now fixed.
On the front page I have the code tweaked so that it shows the 'readmore' link only if there is information on the article page. Otherwise, it is not put in the front page post. Perhaps something is not going right with this in the archives module and it is dropping it for all of them.
I'll try to 'roll back' that code so that it puts it on all articles again to see if I can at least get it to show up period. |
|
|
|
 |
rogue3

|
Posted:
Thu Sep 17, 2009 9:18 am |
|
OK, I've narrowed it down to the tweak I made for the front page.
Previously, I replaced this:
Code:if ($fullcount > 0 OR $c_count > 0 OR $articlecomm == 0 OR $acomm == 1) {
|
with this:
Code:if ($fullcount > 0 ) {
|
And that made the link go away whenever there was no article text. When I change it back I get the 'read more' link on every article again. My guess is that the above variables are not defined in this function. I will look into it some more... |
|
|
|
 |
rogue3

|
Posted:
Thu Sep 17, 2009 11:33 am |
|
It seems the problem is with the $articlecomm variable. If I include it, all of the 'read more' links show up, without it none of them do. I'm not sure how to change this to make only the ones with bobytext show the link. It works just fine for the front page news, but the archives it doesn't seem to want to do it. |
|
|
|
 |
|