[WEB4LIB] SSI

James Cayz cayz at lib.de.us
Wed Feb 16 19:21:47 EST 2000


On Tue, 15 Feb 2000, Gina M Jones wrote:
>Hi, I need to do the following,
>use SSI for creating styles for several directories.  The Title Graphic of
>of each directory has a different graphic.  I don't want to have to create
>a different header file for each.  Nor do I want to force the user to use
>the echo var statement, having to put in the specific image, alt tag, etc. 
> 
>What I would prefer, if I can, to do is to use if
>statements to the effect that if the file is in such and such directory,
>use 1.gif, else, etc.  That way I only have to do 4.  Help?
>
>Gina Jones
>Coordinator, Web Services

Gina,

Depending on what kind of server, you might have Extended SSI, with the if
statement, etc.  For example, Apache.... (Others?)

Given that, you could do a regex compare of the DOCUMENT_URI (the
*requested* page) in one of your header files.  Given that you can
successfully compare the URI to one of the many IF statements in your
headerfile, you can then bring in the appropriate file.

Example:

page a/b-dir/cfile contains a call to header z/y/x

In header file z/y/x, you have a series of statements like

normal header stuff
<!-- Different pictures for different files -->
<!-- #if expr="\"DOCUMENT_URI\" = /a-dir/" -->
<img src=a-dir.jgp>
<!-- #elif expr="\"DOCUMENT_URI\" = /b-dir/" -->
<img src=b-dir.jgp>
...
<!-- #endif -->
Rest of the normal header stuff...


Of course, I haven't hacked it into working, but from the example I cut
from the Apache doc on SSI, and the definition of DOCUMENT_URI, it
*should* work.

Of course, you'll have to let me know if it does... :-)

James

+--------------------------------------------------------------------------+
| James Cayz  #  cayz at lib.de.us #  DelAWARE homepage: http://www.lib.de.us |
| Network Processing Administrator #  302-739-4748 x130 # Fax 302-739-6948 |
| Delaware Division of Libraries # 43 S. DuPont Hwy / Dover, DE 19901-7430 |
+--------------------------------------------------------------------------+



More information about the Web4lib mailing list