Never been to DZone Snippets 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

Generic layout RHTML for Rails apps (See related posts)

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.

(Updated August 2006 to slightly more up to date standards!)

   1  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   2         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   3  
   4  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
   5  <head>
   6  	<title><%= @page_title %></title>
   7  	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   8  	<%= stylesheet_link_tag "main" %>
   9  	<%= javascript_include_tag :defaults %>
  10  </head>
  11  
  12  <body<% if @page_class %> class="<%= @page_class %>"<% end %>>
  13  
  14  	<% unless session[:user_id] %><%= render :partial => "generic/loginstuff" -%><% end %>
  15  
  16  	<div id="container">
  17  	
  18  		<div id="header">
  19  		</div>
  20  	
  21  		<% unless @message_override && @message_override == 1 %><%= render :partial => "generic/messageboxes" %><% end %>
  22  	
  23  		<div id="main">
  24  			<%= yield %>
  25  		</div>
  26  	
  27  		<div id="footer">
  28  		</div>
  29  	
  30  	</div>
  31  
  32  </body>
  33  </html>

Comments on this post

d723 posts on Aug 06, 2005 at 23:46
you can replace
   1  
   2  <%= javascript_include_tag "prototype" %>
   3  <%= javascript_include_tag "effects" %>
   4  <%= javascript_include_tag "dragdrop" %>
   5  <%= javascript_include_tag "controls" %>
   6  <%= javascript_include_tag "nifty" %>

with
   1  
   2  <%= javascript_include_tag "prototype", "effects, "dragdrop", "controls", "nifty" %>


similar with the stylesheets
d723 posts on Aug 07, 2005 at 00:24
Also check out the following link for a possibly preferable way to handle loading javascript code on page load.

http://simon.incutio.com/archive/2004/05/26/addLoadEvent

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


Click here to browse all 5349 code snippets

Related Posts