From: Rasputin Date: 2003-11-18T23:07:50+09:00 Subject: Re: eRuby and URL rewriting * Bermejo, Rodrigo [1135 15:35]: > > http://www.xyz.com/index.html?key=RUBYRULZ&key2=rubyrulz > > require 'cgi' > cgi = CGI.new > > key = cgi['key'] > p key > # [ "RUBYRULZ " ] > key.type > # Array > cgi.query_string.split("&").each {|x| p x } > # "RUBYRULZ " > #"rubyrulz" See below for an rhtml file > Rasputin wrote: > > >* Orion Hunter [1112 22:12]: > > > >>I am in the process of doing some web page authoring using eRuby. > >> > >>My question is this-- how do I access the post/get information in URL > >>rewriting? I know in PHP you use something like > >>given the following URL: http://www.xyz.com/index.html?key=RUBYRULZ For the sake of completeness, here's a .rhtml example: <% require 'cgi' # Require the CGI library cgi = CGI.new() # New CGI object key = cgi.params['key'] %>Test <% if key.empty? %>
Please enter the key:
<% else %> the key is :<%= key %> <% end %> -- Radioactive cats have 18 half-lives. Rasputin :: Jack of All Trades - Master of Nuns