Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional SSI 2

Status
Not open for further replies.

mp9

Programmer
Sep 27, 2002
1,379
GB
Not sure if this is the right forum - please redirect me somewhere else if not.

I know I can use conditional SSI to include a file based on the query string part of the URL, i.e.

Code:
<!--#if expr="${QUERY_STRING} = /new/"-->
<!--#include file="newmenu.htm" -->
<!--#endif -->

But what I want to do is conditionally include a file if the query string doesn't begin with certain characters and I don't know the syntax for the "not equal to" (<> ? != ? Something else?) or the wildcard operator to use (* ? % ? . ? Something else?)

Anyone know?
 
Hi

Yes, is the right forum, as SSI is interpreted by the web server's module, and the interpretation changes abit between servers.
Code:
<!--#if expr="${QUERY_STRING} [red]![/red]= /[red]^[/red]new/"-->
<!--#include file="newmenu.htm" -->
<!--#endif -->

Feherke.
 
No joy. I tried the below, becuase I want to check what the query string starts with, so I presume I had to move the ^ character in feherke's post?
Code:
<!--#if expr="${QUERY_STRING} != /new^/"-->
<!--#include file="newmenu.htm" -->
<!--#endif -->
But if didn't work. Any other thoughts?
 
THanks for your help.

The echo returns new?200606 (site is hosted free by Geocities, who add the ?200606 to the end on my URL to load their ad script, which is why I have to pattern-match the beginning of the query string only).

I tried this but to no avail:
Code:
<!--#if expr="${QUERY_STRING} != /^new/"-->
<!--#include file="newmenu.htm" -->
<!--#endif -->
I also tried this:
Code:
<!--#if expr="${QUERY_STRING} != /new$/"-->
<!--#include file="newmenu.htm" -->
<!--#endif -->
Again with no joy. Whatever I try, newmenu.htm gets included even if my query string begins with the word "new".
 
Hi

Then there is the problem.

You are right, it does not work on Yahoo! Geocities. 1) You should tell us this from the very beginning; 2) How do you know that Yahoo! uses Apache servers ?

And look at the page generated by Yahoo! Geocities :
ssi.htm said:
The QUERY_STRING [highlight #dfd]does not begin[/highlight] [highlight #ddf]begins[/highlight] with "new".

It displays both the "then" and the "else" text. Which means, the [tt]if[/tt] SSI statement does not work at all on Yahoo!.

My suggestion works on Apache without ad forcing manipulations :


I realy hate when I design a nice site structure, then the server does not support it. Sorry, now is your turn to hate it.

Feherke.
 
I echo'ed SERVER_SOFTWARE to know that Geocities are using Apache.

Thanks for all your help with diagnosing this, you deserve a star for your efforts.

And yes, I DO hate that Geocities dose not support this!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top