Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Users

How to test whether a file exist in a ssi page?

 

 

Apache users RSS feed   Index | Next | Previous | View Threaded


thorsten.scherler.ext at juntadeandalucia

May 9, 2008, 1:05 AM

Post #1 of 5 (107 views)
Permalink
How to test whether a file exist in a ssi page?

Hi all,

how can I test whether a file exist in a ssi page?

I have following
<!--#set var="name" value="$DOCUMENT_ROOT/2008/88/test.html" -->
which will return me the path of the file that I need to include if
exists.

Now I want to test whether or not this file exists.

A working but ugly way is the following:
<!--#config errmsg=""-->
<!--#include virtual="/2008/88/test.html"-->

I would like to do something:
<!--#if expr="$DOCUMENT_ROOT/2008/88/test.html"-->
<!--#include virtual="/2008/88/test.html"-->
<!--#else -->
No information available.
<!--#endif -->

Where I do not know which expression to use to do
expr="$DOCUMENT_ROOT/2008/88/test.html EXIST"

TIA for any ideas.

salu2
--
Thorsten Scherler thorsten.at.apache.org
Open Source Java consulting, training and solutions


---------------------------------------------------------------------
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[at]httpd.apache.org
" from the digest: users-digest-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: users-help[at]httpd.apache.org


joshua at slive

May 9, 2008, 6:22 AM

Post #2 of 5 (99 views)
Permalink
Re: How to test whether a file exist in a ssi page? [In reply to]

On Fri, May 9, 2008 at 4:05 AM, Thorsten Scherler
<thorsten.scherler.ext[at]juntadeandalucia.es> wrote:
> Hi all,
>
> how can I test whether a file exist in a ssi page?
>
> I have following
> <!--#set var="name" value="$DOCUMENT_ROOT/2008/88/test.html" -->
> which will return me the path of the file that I need to include if
> exists.
>
> Now I want to test whether or not this file exists.
>
> A working but ugly way is the following:
> <!--#config errmsg=""-->
> <!--#include virtual="/2008/88/test.html"-->
>
> I would like to do something:
> <!--#if expr="$DOCUMENT_ROOT/2008/88/test.html"-->
> <!--#include virtual="/2008/88/test.html"-->
> <!--#else -->
> No information available.
> <!--#endif -->
>
> Where I do not know which expression to use to do
> expr="$DOCUMENT_ROOT/2008/88/test.html EXIST"
>
> TIA for any ideas.

See:
http://httpd.apache.org/docs/2.2/mod/mod_include.html#ssienableaccess

I'm not actually sure if it works. I've never tried it, and I heard
that the directive is actually named SSIAccessEnable rather than
SSIEnableAccess.

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[at]httpd.apache.org
" from the digest: users-digest-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: users-help[at]httpd.apache.org


thorsten.scherler.ext at juntadeandalucia

May 12, 2008, 12:30 AM

Post #3 of 5 (82 views)
Permalink
Re: How to test whether a file exist in a ssi page? [In reply to]

On Fri, 2008-05-09 at 09:22 -0400, Joshua Slive wrote:
> On Fri, May 9, 2008 at 4:05 AM, Thorsten Scherler
> <thorsten.scherler.ext[at]juntadeandalucia.es> wrote:
> > Hi all,
> >
> > how can I test whether a file exist in a ssi page?
> >
> > I have following
> > <!--#set var="name" value="$DOCUMENT_ROOT/2008/88/test.html" -->
> > which will return me the path of the file that I need to include if
> > exists.
> >
> > Now I want to test whether or not this file exists.
> >
> > A working but ugly way is the following:
> > <!--#config errmsg=""-->
> > <!--#include virtual="/2008/88/test.html"-->
> >
> > I would like to do something:
> > <!--#if expr="$DOCUMENT_ROOT/2008/88/test.html"-->
> > <!--#include virtual="/2008/88/test.html"-->
> > <!--#else -->
> > No information available.
> > <!--#endif -->
> >
> > Where I do not know which expression to use to do
> > expr="$DOCUMENT_ROOT/2008/88/test.html EXIST"
> >
> > TIA for any ideas.
>
> See:
> http://httpd.apache.org/docs/2.2/mod/mod_include.html#ssienableaccess
>
> I'm not actually sure if it works. I've never tried it, and I heard
> that the directive is actually named SSIAccessEnable rather than
> SSIEnableAccess.

Invalid command 'SSIEnableAccess', perhaps misspelled or defined by a
module not included in the server configuration
failed!

Invalid command 'SSIAccessEnable', perhaps misspelled or defined by a
module not included in the server configuration
failed!

Not sure whether I configured it the right way but I tried some
combinations. The last one is:

<VirtualHost 1.2.2.3:80>
ServerName myServer
DocumentRoot "/opt/httpd"
SSIAccessEnable on
...

I as well tried within
<Directory "/opt/httpd">

but I cannot start the server anymore after adding the "SSIAccessEnable
on". I am using a ubuntu package (2.2.3-3.2ubuntu2.1) on my developing
box.

However on our testing server we have apache_2.2.8 and adding
"SSIAccessEnable on" within the <Directory "/opt/httpd"> does not
provoke the server restart to fail but does not work either since:

<!--#if expr="-A /2008/88/test.html"-->
<!--#include virtual="/boletines/2008/88/test.html"-->
<!--#else -->
doh!
<!--#endif -->

will result in [an error occurred while processing this directive].

Any ideas?

salu2



> 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[at]httpd.apache.org
> " from the digest: users-digest-unsubscribe[at]httpd.apache.org
> For additional commands, e-mail: users-help[at]httpd.apache.org
>
--
Thorsten Scherler thorsten.at.apache.org
Open Source Java consulting, training and solutions


---------------------------------------------------------------------
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[at]httpd.apache.org
" from the digest: users-digest-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: users-help[at]httpd.apache.org


nick at webthing

May 12, 2008, 5:27 AM

Post #4 of 5 (82 views)
Permalink
Re: How to test whether a file exist in a ssi page? [In reply to]

On Mon, 12 May 2008 09:30:28 +0200
Thorsten Scherler <thorsten.scherler.ext[at]juntadeandalucia.es> wrote:

> <!--#if expr="-A /2008/88/test.html"-->
> <!--#include virtual="/boletines/2008/88/test.html"-->

Is the difference in those paths a typo?

--
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

---------------------------------------------------------------------
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[at]httpd.apache.org
" from the digest: users-digest-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: users-help[at]httpd.apache.org


thorsten.scherler.ext at juntadeandalucia

May 12, 2008, 5:37 AM

Post #5 of 5 (82 views)
Permalink
Re: How to test whether a file exist in a ssi page? [In reply to]

On Mon, 2008-05-12 at 13:27 +0100, Nick Kew wrote:
> On Mon, 12 May 2008 09:30:28 +0200
> Thorsten Scherler <thorsten.scherler.ext[at]juntadeandalucia.es> wrote:
>
> > <!--#if expr="-A /2008/88/test.html"-->
> > <!--#include virtual="/boletines/2008/88/test.html"-->
>
> Is the difference in those paths a typo?

Yeah, but only in the mail, not in the code. Just forgot to cut the
prefix of the second one. thanks for the headsup.

salu2

>
--
Thorsten Scherler thorsten.at.apache.org
Open Source Java consulting, training and solutions


---------------------------------------------------------------------
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[at]httpd.apache.org
" from the digest: users-digest-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: users-help[at]httpd.apache.org

Apache users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.