Erin Mulder on 16 Nov 2005 23:20:10 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PhillyOnRails] Commenting things out in RHTML (or any ERb templates)


Random tip of the day...

If you need to comment out large blocks of Ruby and HTML in your RHTML
templates, try one of the three styles below.

(If you use <!-- and -->, then the Ruby will still get executed.)

Cheers,
Erin

<%#
This commenting style works for regular content, but will prematurely
end if you embed a scriptlet.  If you do end up using this, be sure not
to put a space between the % and the #
%>

<%
=begin
This style will work with scriplets too  <%= now.broken.function(foo) %>
=end
%>

<% if false %>
so will this style <%= now.broken.function(foo) %>
<% end %>


_______________________________________________
talk mailing list
talk@phillyonrails.org
http://lists.phillyonrails.org/mailman/listinfo/talk