Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

get url / uri in *.rhtml file (See related posts)

// find out the current url / uri in *.rhtml file
// is quite simple with the request object
<% page = request.request_uri %>
page: <%= page %>


// or when different urls mean the same page
<% page = "/" + request.path_parameters['controller'] + "/" + request.path_parameters['action'] %>
page: <%= page %>

Comments on this post

kain posts on Mar 10, 2007 at 16:04
with request_uri WEBrick includes the full URL. IIS leaves REQUEST_URI blank.

better use request.path

You need to create an account or log in to post comments to this site.


Related Posts