I've read a lot of the info on the Forums about SSI templates but everything is so scattered that I'm confused, my problem is I can't get one template to work the way I want it to. I've managed to find and alter two templates some of the features in one I like and some of the features in the other I like, I just don't know how to meld the two scripts into one.
This is for a softball website and will be used to show what tournaments are coming up, here is the sample page:
http://www.alaskasoftball.com/caltest.shtml
First Test: I like the top version because it puts the two test tournaments together, problem is it lists the two day tournaments twice.
Second Test: The bottom version is just the opposite, it lists the tournaments only once each but it splits the two tournaments that are happening the same days into two entries.
Third sample: This is what I would envision the final product to look like but I'm unable to see how to join the two templates . . .
Any help would be greatly appreciated!
Code for part 1:
<%
&getEvents( {'duration'=>'30d'} );
$DAY = $Grid->{'grid'}->
- ->
- ;
$EVENTS = $DAY->{events};
$total_events=0;
%>
<table border="0" cellpadding=0 cellspacing=0 width=100%>
<%FOREACH EVENTLIST%>
<%IF EVENTS EXIST%>
<tr>
<td align="center" bgcolor=#eeeeee>
<b><%$total_events++;%>
<%=$DAY->{dayname}%>, <%=$DAY->{monthname}%> <%=$DAY->{dd}%></b>
</td>
</tr>
<tr>
<td><%FOREACH EVENT%>
<img src=artwerk/bullet3.gif height=16 width=8 align=absmiddle>
<% if ($EVENT->{'schedule'}->{'start_time'}) { %><%= $EVENT->{'schedule'}->{'start_time'} %><% } %>
<% if ($EVENT->{'schedule'}->{'end_time'}) { %>-<%= $EVENT->{'schedule'}->{'end_time'} %><% } %>
<% if ($EVENT->{'schedule'}->{'start_time'}) { %> : <% } %>
<A HREF="<%= EVENT FIELD(link) %>"><%= $EVENT->{'details'}->{'title'} %></a><br>
<%/FOREACH%>
</td>
</tr>
<%/IF%>
<%/FOREACH%>
</table>
<%unless($total_events){%>
<br><b>No Games Scheduled</b><br>
<% } %>
Code for part 2:
<% $STYLE = "List";$defaultmax=25; # the default number of events shown$defaultperiod='30d'; # the default period to sample$period=int(lc($in{duration})).'d';if (int($period)==0) {$period=$defaultperiod}; # if no maximum assume default$searchcity=lc($in{city});if (length($searchcity) < 4) {$searchcity=""}; #need at least 4 chars for valid city$searchstate=lc($in{state});if (length($searchstate) < 2) {$searchstate=""}; #need at least 2 chars for valid state$maxevents=$in{maxevents};if ($maxevents==0) {$maxevents=$defaultmax}; # if no maximum assume default$searchcountry=lc($in{country}); if (length($searchstate) > 1) {$searchcountry='usa'};#print 'THIS TEST IS HARD WIRED TO SEARCH THE DATABASE FOR &country=on the command line';#print 'CITY: '.$searchcity.' '.'STATE:'. $searchstate.' '.'COUNTRY '.$searchcountry;#&getEvents( {'duration'=>$in{duration}} ); #original&getEvents({duration=>$period});$DAY = $Grid->{'grid'}->
- ->
- ;$EVENTS = $DAY->{events};$total_events=0; %><!-- BEGIN DATE GATHERING --><% FOREACH EVENTLIST%> <% FOREACH EVENT%> <% $titlearray=$EVENT->{'details'}->{'title'}; $montharray='month'.$EVENT->{'details'}->{'title'};# print 'COUNTRY READS: '.$EVENT->{'details'}->{'country'}.'<BR>'; $thismonth=$DAY->{'monthname'}; push(@$montharray,$thismonth); push(@$titlearray,$DAY->{'dd'}); %> <%/FOREACH%><%/FOREACH%><!-- END DATE GATHERING --><table border="0" cellpadding=0 cellspacing=0 width=100%><%FOREACH EVENTLIST%> <%IF EVENTS EXIST%> <% if ($total_events < $maxevents) { %> <%FOREACH EVENT%> <%$flag=0;%> <%$titlearray=$EVENT->{'details'}->{'title'};%> <%$montharray='month'.$EVENT->{'details'}->{'title'};%> <%foreach $dupetest(@titleevent) {%> <%if ($EVENT->{'details'}->{'title'} eq $dupetest) { $flag=1; }%> <%};%> <% $eventcountry=lc($EVENT->{'details'}->{'country'}); %> <%if ( ($searchcountry eq "") or ($searchcountry =~ m/$eventcountry/ ) ) {%> <% $eventstate=lc($EVENT->{'details'}->{'state'}); %> <%if ( ($searchstate eq "") or ($searchstate =~ m/$eventstate/ ) ) {%> <%if ($flag eq 0) {%> <TR align="center"> <%$total_events++;%> <% $firstdate = shift(@$titlearray); $lastdate = pop(@$titlearray); $firstmonth = shift(@$montharray); $lastmonth = pop(@$montharray); $firstdow=$DAY->{dayabbreviation}; %> <td align="center" bgcolor=#eeeeee><b><%=$firstmonth%> <%=$firstdate%> <% if ($lastdate) { %> -<%if ($firstmonth ne $lastmonth) {%> <%=$lastmonth;%> <%};%> <%=$lastdate;%> <%};%> </b></TD> </tr> <tr> <TD><img src=http://www.alaskasoftball.com/artwerk/bullet3.gif height=16 width=8 align=absmiddle> <A HREF="<%= EVENT FIELD(link) %>"><%= $EVENT->{'details'}->{'title'}; %></A></TD> </TR> <%push(@titleevent,$EVENT->{'details'}->{'title'});%> <%}%> <%}%> <%}%> <%/FOREACH%> <%} %> <%/IF%><%/FOREACH%><%if ($total_events) {%> <%} else {%> <CENTER><I>No Events</I></CENTER><%}%></TABLE>