Open tag, in a helper, will automatically append itself to the document.
So... you might have the line in your haml "- print_nav" (the - means "no
output")
however, the method goes like this
def print_nav
open_tag :div, :class => "nav" do
open_tag "a", "Nav!"
end
return true
end
This will come out with
<div class='nav'>
<a>Nav!</a>
</div>
The meaning of the "return true" is just to demostrate that the return value
doesn't matter... since we are using -. As soon as open_tag or push_text or
other haml-helper methods are called, the results are added to the response
document.
Make sense?
-hampton.
On Fri, Nov 20, 2009 at 6:24 PM, Tal <[email protected]> wrote:
> I'm wanting to make helpers and I've come across open_tag in a few
> places. I can't figure out where it's used though. Do i just have to
> be sure to call it from within something being rendered by haml? or
> can i get it to actually output text?
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Haml" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected] <haml%[email protected]>.
> For more options, visit this group at
> http://groups.google.com/group/haml?hl=.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Haml" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/haml?hl=.