Permalink
Browse files

Added some documentation for set_rotate

  • Loading branch information...
1 parent 3703a5e commit f091d5ba1c160f34ed7a008dcfceaa1d8cf86b33 viperet committed Mar 30, 2012
Showing with 32 additions and 0 deletions.
  1. +32 −0 doc/HttpSetMiscModule.wiki
View
32 doc/HttpSetMiscModule.wiki
@@ -748,6 +748,38 @@ For now, there's no way to configure a custom random generator seed.
Behind the scene, it makes use of the standard C function <code>rand()</code>.
+== set_rotate ==
+'''syntax:''' ''set_random $value <from> <to>''
+
+'''default:''' ''no''
+
+'''context:''' ''location, location if''
+
+'''phase:''' ''rewrite''
+
+Increments <code>$value</code> but keeps it in range from <code>$from</code> to <code>$to</code>.
+If <code>$value</code> is greater than <code>$to</code> or less than <code>$from</code> is will be
+set to <code>$from</code> value.
+
+Only non-negative numbers are allowed for the <code><from></code> and <code><to></code> arguments.
+
+When <code><$from></code> is greater than <code><$to></code>, their values will be exchanged accordingly.
+
+For instance,
+
+<geshi lang="nginx">
+ location /rotate {
+ default_type text/plain;
+ set $counter $cookie_counter;
+ set_rotate $counter 1 5;
+ echo $counter;
+ add_header Set-Cookie counter=$counter;
+ }
+</geshi>
+
+then request <code>GET /rotate</code> will output next number between 1 and 5 (i.e., 1, 2, 3, 4, 5) on each
+refresh of the page. This directive may be userful for banner rotation purposes.
+
== set_local_today ==
'''syntax:''' ''set_local_today $dst''

0 comments on commit f091d5b

Please sign in to comment.