Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8001 Posts in 1848 Topics- by 2099 Members - Latest Member: roi
Calendar Script CommunityCustomizationHacks and Mods (Moderators: scott, DanO, Marty)Reverse sort order by week
Pages: [1]   Go Down
Print
Author Topic: Reverse sort order by week  (Read 809 times)
0 Members and 1 Guest are viewing this topic.
jchechile
Guest
« on: March 12, 2007, 12:33:00 PM »

First of all, here's a link to the page I'm working on:
http://www.slbradio.org/cgi-bin/calendar.pl?template=SLB5ssi.html&enddate=20070312

You'll notice the dates are oldest on top and latest on bottom.  

and when you click on the date, It opens up the events... pretty much all I have going on here is we only put events in on Saturdays, and it's used for the lineup of events between 6 and noon...  the times on this particular page have been omitted because it's supposed to be an archive.  and that info is irrelevant.

That said, since it is an archive, i'd like the most recent dates to be on top... but i can't seem to do anything but change the sort order of the events within the same day...

any ideas?  I can post the code i'm using if necessary...

thanks

------------------
--justin

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 212

Please don't PM me. Post in the open forum.


WWW
« Reply #1 on: March 12, 2007, 04:02:00 PM »

** I can post the code i'm using if necessary **

That is most cases would be necessary as we here have no idea what you're using.

But assuming you're just using a minor modification od the original ssi.thml template:

This line is responsible for getting the sorted events:

<%FOREACH EVENTLIST%>

It is equivalent to:

<% foreach $datestring (sort keys %$EventList) { $DAY = $EventList->{$datestring}; my ($EVENTS) = $DAY->{events};'); %>

Changing <%FOREACH EVENTLIST%> in the template to:

<% foreach $datestring (sort { $EventList{$b} <=> $EventList{$b} } keys %$EventList) { $DAY = $EventList->{$datestring}; my ($EVENTS) = $DAY->{events};'); %>

might reorder the returned event list.

 This code is un-tested so use at your own risk!

Dan O.

------------------

Logged
jchechile
Guest
« Reply #2 on: March 12, 2007, 04:32:00 PM »

hm.
i'm getting a wierd error when i try to do that change...

at first i was getting a syntax error, which i was able to fix, but now it's another error which i'm not sure where it's coming from...

here's the code i'm using to create the example page i posted above:

_________________________


<html>
<body>
<head>
<title>The Saturday Light Brigade - Games Archive</title>
<link href="http://slbradio.org/slb.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE="javascript" SRC="http://slbradio.org/js/swap.js"></SCRIPT>
</head>
<table bgcolor="D0CF48" height="100%"><tr><td><a href="http://www.slbradio.org/cgi-bin/calendar.pl?template=SLB4ssi.html&duration=7d"><img src="http://slbradio.org/art/thisWeekShade.gif" border="0"></a><a href="http://www.slbradio.org/cgi-bin/calendar.pl?template=SLB3ssi.html&duration=30d"><img src="http://slbradio.org/art/comingUpLit.gif" border="0"></a><a href="http://slbradio.org/pastShows.html"><img src="http://slbradio.org/art/pastShowsShade.gif" border="0"></a>
<br><br>
<a href="http://slbradio.org/pastShows.html" target="_self"><img src="http://slbradio.org/art/gamesArchive.jpg" alt="Switch to Audio Archive Display" border="0"></a><br><br>
<div style="height: 410px; width: 305px;overflow: auto; scrollbar-base-color 0CF48;scrollbar-arrow-color:ffffff;padding:7;">
<!--#include file="preferences.pl"-->
<%
&getEvents( {startdate=>'20070101',range=>'year',enddate=>$in{enddate}} );
$DAY = $Grid->{'grid'}->

  • ->
  • ;
    $EVENTS = $DAY->{events};
    $total_events=0;
    %>
    <table width="90%" border="0" cellspacing="0" cellpadding="0"><div align="center"><font size="2" face=" Arial, Helvetica, sans-serif" color="#473903">Click on the date to display the games featured on that week's program</font><br><br></div><% foreach $datestring (sort { $EventList{$b} <=> $EventList{$b} } keys %$EventList) { $DAY = $EventList->{$datestring}; my ($EVENTS) = $DAY->{events};'); %><%IF EVENTS EXIST%><%$curr_events = 0;%><%FOREACH EVENT%><%$curr_events++ if (($EVENT->{details}->{inclusion} eq "Games") and ($EVENT->{details}->{inclusion} ne "Coming Up")); %><%/FOREACH%><%next unless ($curr_events);%><%$total_events++;%><tr><td colspan="2">
       <font size="2" face=" Arial, Helvetica, sans-serif" color="#473903">
          <span style="cursor:hand" title="Click to Expand" onClick="showDiv('<%=$datestring%>');return false;"><strong><%=$DAY->{monthname}%> <%=$DAY->{dd}%> <%=$DAY->{yyyy}%></strong></span>   <br>
          <div id="<%=$datestring%>" style="display:none"><%FOREACH EVENT%><% next if (($EVENT->{details}->{inclusion} ne "Games") or ($EVENT->{details}->{inclusion} eq "Coming Up")); %>
               
             <A HREF="<%=$CGI_URL%>?calendar=<%=$in{'calendar'}%>&view=Event&event_id=<%= EVENT FIELD(id) %>" STYLE="text-decoration: none; color:663366" CLASS="text"><%= EVENT FIELD(title) %></A>
             <br>
             <%/FOREACH%>
                         
                      
                   </font>
                </td>
             </tr><%/IF%><%/FOREACH%></div>
             
    </table>
    <%unless($total_events){%>
    <CENTER><I>No Events</I></CENTER>
    <% } %>
    </div></td></tr><tr><td height="100%"></td></tr></table></body></html>

    ------------------

    maybe this will help ??
    i will also keep trying to figure out where the error is coming from specifically..

    I'll leave the test page up with the mod that gave the error so you can see that too.

    thanks for replying so fast!

    --justin

    [This message has been edited by jchechile (edited March 12, 2007).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 212

Please don't PM me. Post in the open forum.


WWW
« Reply #3 on: March 12, 2007, 05:28:00 PM »

** Bad name after calendar' at (eval 5) line 51. ***

What's on line 51 (and a couple before and after) of the template?

Dan O.

------------------

Logged
jchechile
Guest
« Reply #4 on: March 12, 2007, 05:37:00 PM »

well that's the wierd thing... the template only has 37 lines... it's literally that code that i posted above.

when i click on the line 51 and view the highlighted code it shows me this perl code that I dont really understand, it's hard to wade through the quotes and such to figure out exactly what's gone wrong...

but here's the code it highlights as off:

         print "
\n           
\n         <A HREF=\"";print $CGI_URL;print "?calendar=";print $in{'calendar'};print "&view=Event&event_id=";print $EVENT->{details}->{id};print "\" STYLE=\"text-decoration: none; color:663366\" CLASS=\"text\">";print $EVENT->{details}->{title};print "</A>
\n         <br>
\n         ";

also:
i've managed to figure out that if i make the link code to the event less dynamic, ie hard write some code that basically never changes... i get a new error.

I'll do that to the code and you can click on the link in my first post to see the new error it provides.

-- what i don't get is that it worked just fine without making this mod, and what does the mod change that interferes with the pre-existing code... hm


------------------
--justin

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 212

Please don't PM me. Post in the open forum.


WWW
« Reply #5 on: March 13, 2007, 01:59:00 AM »

If the template line that starts:

<table width="90%" border="0"....

wasn't on one great big line, it might be easier to find the problem code. This part definitely doesn't look right:

my ($EVENTS) = $DAY->{events};');

It looks to have an extra '); probably because it is used differently where I copied it from.

This isn't right either

<%$curr_events++ if

If anything, it needs a semicolon to separate the statements:

<% $curr_events++; if

I might suggest you start with a fresh copy of the ssi.html template and first try to get it displaying the way you want and only then, worry about its formatting.

JMO

Dan O.

------------------

Logged
jchechile
Guest
« Reply #6 on: March 13, 2007, 11:34:00 AM »

this template was a long time coming to get it to where it's at..

i can reformat the html for you to take a look at... i'd be happy to... the only reason i went and put it on one line was i was tired of looking at the html that it produced having Huge spaces in it, it made it hard to look through to troubleshoot...

i appreciate your help so far.

------------------
--justin

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 212

Please don't PM me. Post in the open forum.


WWW
« Reply #7 on: March 13, 2007, 11:46:00 AM »

** i can reformat the html for you to take a look at... **

It's the actual Perl code that's important, not the HTML. And just "looking at" a better formatted template would be useless. The template would have to be used in that layout to see which line(s) was actually producing the error(s) so they could be looked into.

JMO

Dan O.

------------------

Logged
jchechile
Guest
« Reply #8 on: March 13, 2007, 12:08:00 PM »

oh ok, i was just kind of thinking about when you said

**If the template line that starts:
<table width="90%" border="0"....

wasn't on one great big line, it might be easier to find the problem code.**

i just thought that might help...
ok well i'll try figuring this out a little more on my own.

------------------
--justin

Logged
Pages: [1]   Go Up
Print
Jump to: