httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jsl...@gmail.com>
Subject Re: [users@httpd] SSI functions to compare dates?
Date Mon, 25 Jul 2005 17:53:12 GMT
On 7/25/05, Doug Lipman <doug@storydynamics.com> wrote:
> Hi,
> 
> I'm trying to use SSI (via XBitHack) to include a file or a bit of
> text in certain existing web pages only until a date I set in code.
> In other words, I want my pages to display certain text until an
> expiration date, and only until then. I know how to do this in PHP,
> but I don't want to have to rename my files from .html.

First, it is not necessary to rename your files to use PHP.  PHP can
be configured to work on any extension, not just .php.

> 
> This is how I've approached the problem:
> 
>         <!--#set var="now_date" value="$DATE_LOCAL"-->
>         <!--#set var="exp_date" value="[something goes here that is
> based on the date I want the include-file to stop appearing]"-->
>         <!--#if expr='"now_date > exp_date"' -->
>         <!--#include virtual="../../includes/file_to_include.inc" -->
>         <!--#endif -->
> 
> Here are my questions:
> 1. In the third line above, would now_date (derived from DATE_LOCAL)
> be in Unix time? Or else in what form?

See
http://httpd.apache.org/docs/2.0/mod/mod_include.html
where you will find the "timefmt" option of the "config" element.

> 2. Is there a function I can call in the second line above to encode
> a date into Unix time (or whatever the answer is to my first
> question?)

Not as part of SSI.  You can generate that using standard time
functions under c/perl/python/whatever.

> 
> Or, is there a better way to approach this problem?

mod_rewrite can do rewriting conditional on date, which is an
alternative approach.

If you are most comfortable with php, I'd simply use that.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message