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


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Pages: [1]   Go Down
Print
Author Topic: Modifying FullYear Template  (Read 313 times)
0 Members and 1 Guest are viewing this topic.
CarlC
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« on: February 02, 2005, 06:07:00 PM »

I am trying to set up a event listing site and found that CalendarScript321 with the Chronological List Template may do the trick.

The results I have been able to get sofar can be seen at the below link;
http://www.eventslister.com/cgi-bin/calendar.pl?template=sampleG.htm&duration=365

I am not good at programming at all but will take what time I need to to experiment and see if I can figure things out.

I'm stuck where I'm at and was hoping someone could point me in the correct direction.

This is what I'm trying to do.
1. Eliminate the No. Column
2. Add the year in the date column
3. Add City field (has been added in admin)
4. Add State field (has been added in admin)

Any help would be appreciated, if I'm doing this completely wrong let me know, in my 60 years I've done plenty of things the wrong way and don't take offense.

Thanks in advance

[This message has been edited by CarlC (edited February 02, 2005).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #1 on: February 03, 2005, 02:41:00 PM »

** 1. Eliminate the No. Column  **

Search the template code for "No" (without the quotes, exact case) and remove it along with the surrounding <td..> </td> tags. That will remove the column title.

Them remove the line <TD><font size="1"><%=$total_events%>.</TD> which prints the line number.

** 2. Add the year in the date column **

The year may be able to printed with the following tag, insert it where appropriate and see.

<%= $DAY->{yyyy} %>

** 3. Add City field (has been added in admin) 4. Add State field (has been added in admin) **

You're going to need to know the 'key' value for any fields you want printed (maybe "city" and "state"?). You can then print them using tags like:

<%= $EVENT->{'details'}->{'Field_Key_Field'} %>

eg. <%= $EVENT->{'details'}->{'city'} %>

You'll need to figure out where the corresponding HTML table tags will need to go. The column titles will likely need to go in the area where you removed the "No" and the corresponsing <td...>,</td> tags.

Dan O.


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

Logged
CarlC
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #2 on: February 03, 2005, 05:19:00 PM »

Dan

You got me started but I got lost soon after

I found where to delete the No column, and I added 2 new headings for city & state.

I don't see anywhere in the event_detail.html that there is any  formating info.

I tried to replace all the occurences of $DAY- with >{yyyy} but that killed the dates all together.

I'm including below what I'm working with in the script.

$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->{'monthabbreviation'};
             push(@$montharray,$thismonth);
             push(@$titlearray,$DAY->{'dd'});   %>
        <%/FOREACH%>
    <%/FOREACH%>
    <!-- END DATE GATHERING -->

    <TABLE border=1 cellspacing="3" cellpadding="3" ><CAPTION><b></b></CAPTION>
    <TR align="center" ><TD><font size="3">DATES</TD><TD><FONT SIZE="3">EVENT TITLE</TD><TD><font size="3">City</TD><TD><FONT SIZE="3">State</TD></font></TR>

    <%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"><font size="2"><%=$firstmonth%> <%=$firstdate%>
                               <% if ($lastdate) { %>
                                     ~<%if ($firstmonth ne $lastmonth) {%>
                                           <%=$lastmonth;%>
                                     <%};%>
                                     <%=$lastdate;%>
                               <%};%>
                               </FONT></TD>
                               <TD><font size="2"><A HREF="<%=$CGI_URL_QUERYSTRING%>popup=1&template=event_detail.html&event_id=<%=$EVENT->{'details'}->{'id'}%>" STYLE="text-decoration:underline;" onClick="showDetails('<%=$EVENT->{'details'}->{'id'}%>');return false;"><%= $EVENT->{'details'}->{'title'}; %></A></TD>
                               </TR>
                               <%push(@titleevent,$EVENT->{'details'}->{'title'});%>
                          <%}%>
                     <%}%>
                 <%}%>
             <%/FOREACH%>
           <%} %>
        <%/IF%>
    <%/FOREACH%>

    <%if ($total_events) {%>
        Total Events: <%=$total_events%>   <%=$period%> View<BR>
    <%} else {%>
        <CENTER><I>No Events</I></CENTER>
    <%}%>

    </TABLE>

    If anyone has time I appreciate the help.

    Thanks again

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #3 on: February 03, 2005, 06:08:00 PM »

** I tried to replace all the occurences of $DAY- with >{yyyy} **

Were did you get that from? I said to put the tag <%= $DAY->{yyyy} %> where you wanted the year to be printed.

** I don't see anywhere in the event_detail.html that there is any formating info. **

Me neither. If you want it changed you'll likely have to do it manually.  

There is a similar template in the 'Meta Calendar' plug-in's files called event_detail_popup.html which could probably be used instead. Its display preferences should take those defined for the main calendar. To use with that other template, you'd either have to change the references to event_detail.html in it or rename the new template to that name.

Dan O.

[This message has been edited by DanO (edited February 03, 2005).]

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