<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: rhtml code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 27 Jul 2008 02:20:00 GMT</pubDate>
    <description>DZone Snippets: rhtml code</description>
    <item>
      <title>Migrate rhtml views into erb views within subversion repository</title>
      <link>http://snippets.dzone.com/posts/show/3624</link>
      <description>From &lt;a href="http://opensoul.org/2007/3/4/renaming-rhtml-to-erb-using-ruby"&gt;Brandon Keepers&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;To migrate rhtml views into erb views within subversion repository:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Dir.glob('app/views/**/*.rhtml').each do |file|&lt;br /&gt;  puts `svn mv #{file} #{file.gsub(/\.rhtml$/, '.erb')}`&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 04 Mar 2007 07:57:36 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3624</guid>
      <author>nicwilliams (Dr Nic Williams)</author>
    </item>
    <item>
      <title>find out the current url / uri in *.rhtml file</title>
      <link>http://snippets.dzone.com/posts/show/2841</link>
      <description>// find out the current url / uri in *.rhtml file&lt;br /&gt;// is quite simple with the request object&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;% page = request.request_uri %&gt;&lt;br /&gt;page: &lt;%= page %&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;// but then different urls mean the same page &lt;br /&gt;// (../admin = ../admin/ = ../admin/index = ..admin/index/)&lt;br /&gt;// and maybe the id is unwanted too (../admin/show/8)&lt;br /&gt;// so below is an alternative with control on which parameter is used&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;% page = "/" + request.path_parameters['controller'] + "/" + request.path_parameters['action'] %&gt;&lt;br /&gt;page: &lt;%= page %&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;</description>
      <pubDate>Mon, 16 Oct 2006 19:40:40 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2841</guid>
      <author>ovhaag (Oliver Haag)</author>
    </item>
    <item>
      <title>Generic layout RHTML for Rails apps</title>
      <link>http://snippets.dzone.com/posts/show/552</link>
      <description>This will not be 100% for everyone, but I use it for most of my apps and it does all the most important stuff I can't be bothered to retype each time.&lt;br /&gt;&lt;br /&gt;(Updated August 2006 to slightly more up to date standards!)&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"&lt;br /&gt;       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;&lt;br /&gt;&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;	&lt;title&gt;&lt;%= @page_title %&gt;&lt;/title&gt;&lt;br /&gt;	&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;&lt;br /&gt;	&lt;%= stylesheet_link_tag "main" %&gt;&lt;br /&gt;	&lt;%= javascript_include_tag :defaults %&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;br /&gt;&lt;body&lt;% if @page_class %&gt; class="&lt;%= @page_class %&gt;"&lt;% end %&gt;&gt;&lt;br /&gt;&lt;br /&gt;	&lt;% unless session[:user_id] %&gt;&lt;%= render :partial =&gt; "generic/loginstuff" -%&gt;&lt;% end %&gt;&lt;br /&gt;&lt;br /&gt;	&lt;div id="container"&gt;&lt;br /&gt;	&lt;br /&gt;		&lt;div id="header"&gt;&lt;br /&gt;		&lt;/div&gt;&lt;br /&gt;	&lt;br /&gt;		&lt;% unless @message_override &amp;&amp; @message_override == 1 %&gt;&lt;%= render :partial =&gt; "generic/messageboxes" %&gt;&lt;% end %&gt;&lt;br /&gt;	&lt;br /&gt;		&lt;div id="main"&gt;&lt;br /&gt;			&lt;%= yield %&gt;&lt;br /&gt;		&lt;/div&gt;&lt;br /&gt;	&lt;br /&gt;		&lt;div id="footer"&gt;&lt;br /&gt;		&lt;/div&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 05 Aug 2005 04:25:40 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/552</guid>
      <author>peter (Peter Cooperx)</author>
    </item>
    <item>
      <title>Zebra stripes on table rows using Rails / RHTML</title>
      <link>http://snippets.dzone.com/posts/show/408</link>
      <description>&lt;code&gt;&lt;% @projects.each_with_index do |project, i| %&gt;&lt;br /&gt;&lt;% row_class = i%2 == 0 ? "even" : "odd" %&gt; &lt;br /&gt;&lt;tr class="&lt;%= row_class %&gt;"&gt;&lt;br /&gt;......&lt;br /&gt;&lt;% end %&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In the CSS:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;TR.even { background-color: #f00; }&lt;br /&gt;TR.odd { background-color: #f00; }&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;etc..</description>
      <pubDate>Wed, 22 Jun 2005 09:57:04 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/408</guid>
      <author>peter (Peter Cooperx)</author>
    </item>
  </channel>
</rss>
