Re: String operations in ssi

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2008-03-12 at 10:40 +0100, Thorsten Scherler wrote:
> Hi all,
> 
> are string operations in ssi possible?
> 
> I need to compare two strings but only the root path of them. My use
> case is the following:
> 
> <!--#if expr="$REQUEST_URI == $MAP" -->
> 
> MAP = /boletines/2008/1/index.html
> 
> Now REQUEST_URI can have different values, the portal page has:
> REQUEST_URI=/boletines/2008/1/index.html
> 
> which results in a match, but changing REQUEST_URI
> to /boletines/2008/1/d/1.html
> obviously do not match.
> 
> However I want to compare only /boletines/2008/1 and if it is the same
> than the condition should be true, is that possible? 

Well, it is (kind of). ;)

I ended up using regexp to do it:

<!--#if expr="$map == /^\/boletines\/(\\d{4})\/(\\d+)/" -->
<!--#set var="mapYear" value="$1" -->
<!--#set var="mapNumber" value="$2" -->
<!--#endif -->
<!--#if expr="$REQUEST_URI == /^\/boletines\/(\\d{4})\/(\\d+)/" -->
<!--#set var="year" value="$1" -->
<!--#set var="number" value="$2" -->
<!--#endif -->
<ul>
<!--#if expr="$year=$mapYear && $number=$mapNumber" -->
...

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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux