After using Drupal's template.php file to preprocess html and add unique classes to various html elements, I because very dependent on page specific css classes. While building a Ruby on Rails app, I thought it would be nice to at least add in a page-specific body class. Here's a quick snippet you can use:
<%
page = request.request_uri.gsub(/^(\/)?/, '')
page = page.gsub(/\//, '-')
%>
This will:
- Grab the current url (after the domain)
- Strip the leading slash
- Replace all forward slashes with dashes
I highly recommend this post on Rails for PHP developers. As a PHP developer, I found that it really helped to smooth out the Ruby learning curve.
I am interested in becoming
I am interested in becoming your subscriber, so please keep me updated. I find the thoughts and opinions of this blogger, very inspiring and actually worth following. Nice work.
<a href="http://ezleaserentals.com/">ez lease rentals review</a>
Add new comment