YLombardi February 2016
Lemonldap skin rule based on url parameter
I try to configure lemonldap to use different skin based on the url.
I use this documentation :
Rule: a Perl expression (you can use %ENV hash to get environment variables, or $_url to get URL called before redirection, or $ipAddr to use user IP address). If the rule evaluation is true, the corresponding skin is applied.
I try to write a rule that return true if the $_url contains a parameter. But I don't know Perl language.
For example, if the url is
http://myurl:8097/?skin=dark, I want to use the dark skin. If the url is http://myurl:8097/?skin=pastel, I want to use the pastel skin.
How can I check this with a perl expression?
I already try:
$_url =~ dark
$_url =~ $dark
$_url =~ /dark
None of this works.
ikegami February 2016
You're looking for
$_url =~ /dark/
The match operator is documented in
perlop. (Search for the bullet starting with
It's a poor check since it looks for
dark anywhere in the URL. The following would be better:
$_url =~ /[?&;]skin=dark(?:[&;]|\z)/
Asked in February 2016
Viewed 1,370 times Voted 14 Answered 1 times
Leave an answer
Quote of the day: live life
Devs Planet © all rights reserved