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: SSI call to display today's events  (Read 541 times)
0 Members and 1 Guest are viewing this topic.
Jason S
New Member
*

Karma: 0
Offline Offline

Posts: 3


WWW
« on: August 22, 2003, 02:45:00 PM »

I am not a big SSI person, but wanted to see if I could display today's events in list format on my home page.  The problem is when I put in the SSI call <!--#exec cgi="cgi-bin/cal/calendar.pl"--> it displays the default.html template, so the whole monthly grid appears.  My only conclusion is that the cgi script is not detecting that it is an SSI call (according to the documentation page the script automatically detects SSI calls) and is not using the ssi.txt & ssi.html template files.

Now I have seen a few solutions in other posts that don't appear to work because my web host only supports the "exec cgi" command for SSI calls.

Any ideas are welcome.

Thanks,
Jason

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: August 22, 2003, 03:41:00 PM »

** Any ideas are welcome. **

If you can't use the other SSI calls, you could display the SSI template in a iframe on your page.

Dan O.

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

Logged
Jason S
New Member
*

Karma: 0
Offline Offline

Posts: 3


WWW
« Reply #2 on: August 27, 2003, 02:13:00 PM »

I fixed the calendar.pl file so it reads in the SSI before the CGI. I did this by changing the "# Get input Data" section. I made the "elsif ($ENV{'DOCUMENT_URI'})" be the first if statement and changed the "if ($ENV{'REQUEST_METHOD'})" to be an "elsif".
I tried to put the explanation above in simple terms in case anyone is confused (or just wants to see) I have posted my new "# Get input Data" section below. I don't believe that this change will cause any problems (at least it hasn't yet). If any one has comments please post them.

code:

# Get input Data
# --------------
sub getInput {
   my ($in,@in,$key,$val);
   my (@keys,%formvars);
   if ($ENV{'DOCUMENT_URI'}) {
      open(SSI,$BASE_DIR."ssi.txt");
      while(<SSI> ) {
         chomp;
         ($key,$val) = ( /^\s*([^=]+)\s*=\s*"?(.*?)"?$/o );
         $key =~ s|\s*$| |;
         $val =~ s|\s*$| |;
         next unless ($key);
         $in{$key} = $val;
         }
      close(SSI);
      $no_session = 1;
      }
   
   elsif ($ENV{'REQUEST_METHOD'}) {
      if ($ENV{'REQUEST_METHOD'} eq "GET") { $in = $ENV{'QUERY_STRING'}; }
      elsif ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN,$in,$ENV{'CONTENT_LENGTH'}); }
      @in = split(/&/,$in);
      # First get all the raw form vars
      foreach $i (0 .. $#in) {
         $in[$i] =~ s/\+/ /g;    ($key, $val) = split(/=/,$in[$i],2);
         $key =~ s/%(..)/pack("c",hex($1))/ge;
         $val =~ s/%(..)/pack("c",hex($1))/ge;
         # Keep a record of their order, because later values take precendent
         push(@keys,$key);
         $formvars{$key} = $val;
         }
      # Process the special QUERY_STRING field, if it exists
      # These values come first and then might be over-written
      if ($formvars{'QUERY_STRING'}) {
         @in = split(/&/,$formvars{'QUERY_STRING'});
         foreach $i (0 .. $#in) {
            $in[$i] =~ s/\+/ /g;    ($key, $val) = split(/=/,$in[$i],2);
            if ($val ne "") {
               $in{$key} = $val;
               if ($in{'datestring'} && (($key eq 'year') | | ($key eq 'month') | | ($key eq 'date'))) {
                  delete $in{'datestring'};
                  }
               if ($key eq "datestring") {
                  delete $in{'year'};
                  delete $in{'month'};
                  delete $in{'date'};
                  }
               }
            }
         delete $formvars{'QUERY_STRING'};
         }
      # Process all the new field values, over-writing the old ones
      foreach $key (@keys) {
         next if ($key eq "QUERY_STRING");
         $in{$key} = $formvars{$key};
         if ($in{'datestring'} && (($key eq 'year') | | ($key eq 'month') | | ($key eq 'date'))) {
            delete $in{'datestring'};
            }
         if ($key eq "datestring") {
            delete $in{'year'};
            delete $in{'month'};
            delete $in{'date'};
            }
         }
      # Form the query string from form input
      foreach $key (keys %in) {
         if (($key eq "command") | | ($key eq "username") | | ($key eq "password") | | ($key =~/^FIELD_/)) {
            delete $formvars{$key};
            next;
            }
         if ($QUERY_STRING ne "") { $QUERY_STRING .= "&"; }
         $QUERY_STRING .= &URLEncode($key) . "=" . &URLEncode($in{$key});
         }
      $FORM_QUERY = join('&', map {"$_=$formvars{$_}"} keys %formvars);
      }
   elsif ($#ARGV >= 0) {
      while ($in = shift(@ARGV)) {
         ($key,$val) = split(/=/,$in);
         $in{$key} = $val;
         }
      $no_session = 1;
      $no_header=1;
      }
   }

#################################
# Here is all the dirty work... #
#################################


[This message has been edited by Jason S (edited August 27, 2003).]

Logged
jgold723
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #3 on: October 09, 2003, 02:25:00 PM »

Hi Jason:

I'm having the same problem. I tried your code, but it didn't work -- actually nothing came up in the SSI call and when I tried the calendar, I got an Internal Server Error.

I copied the code directly from your posting and it looked OK on the page -- I don't think I missed any brackets, semicolors, etc.

Any suggestions?

Thanks,

John

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #4 on: October 09, 2003, 08:45:00 PM »

** when I tried the calendar, I got an Internal Server Error. **

If the script isn't running, the SSI template won't work either.

** I copied the code directly from your posting **

This forum software adds spaces between double bars (| |) which shouldn't be there.
At the very least it effects the following lines of the code posted previously, probably more lines as well.

$key =~ s|\s*$| |;
$val =~ s|\s*$| |;

Dan O.

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

Logged
Jason S
New Member
*

Karma: 0
Offline Offline

Posts: 3


WWW
« Reply #5 on: November 04, 2003, 10:21:00 AM »

Dan O has a point about the spaces.  I can post or email a text file with the code in it.  Just let me know.

Jason

Logged
ebell
New Member
*

Karma: 0
Offline Offline

Posts: 0

Consultant


WWW
« Reply #6 on: November 07, 2003, 10:37:00 PM »

The "fix" seemed to work fine for me...after Jason e-mailed me a copy of the file...AND after I made sure that the CHMOD was 755 for the new file!

Thanks for the help.

Ethan

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

Logged
shancock
New Member
*

Karma: 0
Offline Offline

Posts: 0

systems analyst


WWW
« Reply #7 on: November 08, 2003, 04:48:00 PM »

Our calendar on RH7.3 will not pay any attention to the ssi.txt file. It must be broken. We got around it by cloning another calendar.cgi to calendar2.cgi. Then we make the ssi call as: <!--#exec cgi="/cgi-bin/calendar2.cgi"-->.

This second copy has been changed to call the correct template so it will not display the whole month as it does for you and should do when opening the calendar normally.

Search for "template=" in the calendar2.cgi file and change the template to what you want ( we use ssi_max_events ).

You can see our example on www.coliseumbooks.com.

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

[This message has been edited by shancock (edited November 08, 2003).]

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