!--#config timefmt=blahblahblah-- with Apache::SSI

2000-07-03 Thread Roediger Stephan

Hi,

Does anyone knows, why standard SSI-Tag: !--#config timefmt="%blah"--
doesn't work with Apache::SSI (maybe it's currently not supported)???
Other used SSI-Tags are interpreted perfectly by Apache::SSI.

Thank you,
Stephan




RE: !--#config timefmt=blahblahblah-- with Apache::SSI

2000-07-03 Thread Sang Han


-Original Message-
From: Roediger Stephan [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 03, 2000 9:38 AM
To: '[EMAIL PROTECTED]'
Subject: !--#config timefmt=blahblahblah-- with Apache::SSI


Hi,

Does anyone knows, why standard SSI-Tag: !--#config timefmt="%blah"--
doesn't work with Apache::SSI (maybe it's currently not supported)???
Other used SSI-Tags are interpreted perfectly by Apache::SSI.

Thank you,
Stephan


I came across this as well when one of our templates which uses SSI to
format a time.

I subclass Apache::SSI and overwrote the ssi_echo and echo _DATE_LOCAL
method. As far as I can tell there is an environment variable called
DATE_LOCAL which keeps sub_DATE_LOCAL from ever getting called and this
seems to ignore any settings made through the ssi_config method in
Apache::SSI.  Probably a better way to fix this, but this works for me. --
sang

package MySSI;

sub BEGIN {
use Date::Format;
use base qw(Apache::SSI);
}

sub ssi_echo {
my($self, $args) = @_;
my $var = $args-{var};
$self-_interp_vars($var);
my $value;
no strict('refs');

if ($var eq 'DATE_LOCAL') {
return $self-echo_DATE_LOCAL;
} elsif (exists $ENV{$var}) {
return $ENV{$var};
} elsif ( defined ($value = $self-{_r}-subprocess_env($var)) ) {
return $value;
} elsif (defined {"echo_$var"}) {
return {"echo_$var"}($self-{_r});
}
return '';
}

sub echo_DATE_LOCAL {
my $self = shift;
if(exists $self-{timefmt}) {
return time2str($self-{timefmt},time) ?
time2str($self-{timefmt},time) : scalar localtime;
}
return 1+time;
return scalar localtime;
}

1;