[OPEN-ILS-DEV] apache skin environment variable
Thomas Berezansky
tsbere at mvlc.org
Mon Nov 29 22:39:14 EST 2010
I could see slightly more processing for (I think) significant gain,
but I am more concerned with a number of other details, mostly in the
example eg_vhost.conf file (which I think you based your block on).
First, the [L] there is "last", as in "stop processing rewrites". If
it were being used in a valid manner it would break all following
rewrites, and the example file has it all over the place. If you
intend for it to be the last rule, it should be in the first set of []
with the E= portion, like this:
[E=skinname:%1,L]
With it in a second [] it will (currently) be ignored by the engine.
This is done correctly and incorrectly throughout the example file,
and the incorrect ones probably shouldn't be thinking about doing it
anyway. Unless the incorrect ones are trying to use it as a "this is
the end of this set", which I think should be done with a comment
instead of a currently ignored flag block.
Second, the "RewriteRule - -" portion will only ever match if there is
a - in the URL (the second - being "no substitution" and correct).
While this generally holds true in our case (the locale in xx-YY form
is dumped in there normally) I don't think that it should be relied
on. A better form would be "RewriteRule . -" or "RewriteRule .* -".
Third, for sanity purposes, I would recommend somewhere early in the
processing tree a
<!--#if expr='"$skinname" == ""'-->
<!--#set var="skinname" value="default"-->
<!--#endif-->
block. Or, alternatively in the rewriterules:
RewriteCond %{ENV:skinname} ^$
RewriteRule .* - [E=skinname:default]
Thomas Berezansky
Merrimack Valley Library Consortium
Quoting James Fournie <jfournie at sitka.bclibraries.ca>:
> Hey there,
>
> I'm wondering if anyone has considered adding this to the eg_vhost.conf :
>
> RewriteEngine ON
> RewriteCond %{REQUEST_URI} ^/opac/.*?/skin/(.*?)/
> RewriteRule - - [E=skinname:%1] [L]
>
> Then wherever /skin/default/ appears, replace it with /skin/<!--echo
> var="skinname"--> or something like that.
>
> Does this approach make sense? Then you can just copy the /default
> skin if you want to make your own skin and don't need to update dozens
> of URLs. Are there any drawbacks to this?
>
> Thanks
>
> ~James Fournie
> SITKA
>
More information about the Open-ils-dev
mailing list