Created
May 6, 2011 16:45
-
-
Save avit/959319 to your computer and use it in GitHub Desktop.
Rails Layout & yield blocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>My Cool Site : <%= yield :title %></title> | |
</head> | |
<body> | |
<div id="main"> | |
<%= yield %> | |
</div> | |
<div id="sidebar"> | |
<%= yield :sidebar %> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% content_for :title, "This is a test" %> | |
<h1><%= yield :title %></h1> | |
<p>This file contains the content that will show up in the "yield" block in the layout...</p> | |
<% content_for :sidebar do %> | |
<p>Let's say some secondary content goes here...</p> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment