ERB Nested Buffering Plugin for Ruby on Rails
October 10th, 2007
ErbBuffer
Painless Nested output buffering, for the masses!
Get it Here
./script/plugin install svn://ahgsoftware.com/erb_buffer/trunk |
Example usage in a typical Erb view
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
@contents = capture_buffer do %># view code here<% end <%= @contents $> # For nesting, here's an example from the readme <% @contents_surface = capture_buffer do %> Top level goodies <% @contents_shallow = capture_buffer do %> Mid level content <% @contents_deep = capture_buffer do %> deeper deeper, i say, deepah <% end %> <% end %> <% end %> <h1>Contents top level</h1> <%= @contents_surface %> <h1>Contents medium level</h1> <%= @contents_shallow %> <h1>Contents deep level</h1> <%= @contents_deep %> <h1>An odd juxstaposition</h1> <%= @contents_surface + @contents_deep %> |
Leave a Reply