It works, and I understand why! Very nice. Thank you.
-c.
On Mar 13, 10:17 pm, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote:
> First, your Haml for the image tag is missing the ":src =>" from its
> attribute hash (also, all images should have alternate text). It should be:
>
> %img#thumb{:src => "/images/my_pic.gif", :alt => "My Pic"}
>
> Second, the problem with your code is that you're trying to put Haml
> code inside Ruby code. Ruby doesn't understand Haml, so this isn't going
> to work. There are two ways you could do this. You could go all-Ruby,
> and use the image_tag method, like so:
>
> = link_to image_tag('my_pic.gif', 'My Pic', :id => 'thumb'), "www.mysite.com"
>
> Or you could go all-Haml, and make an actual link element, like so:
>
> %a{:href => "www.mysite.com"}
> %img#thumb{:src => "/images/my_pic.gif", :alt => "My Pic"}
>
> Whichever way works better for you.
>
> - Nathan
>
> cd wrote:
> > Hello,
> > Haml newbie here.
>
> > I'm having trouble writing the hamlized version of this:
> > <a href="www.mysite.com"><img id="thumb" src="/images/my_pic.gif"></a>
>
> > I tried
> > link_to %img#thumb{"/images/my_pic.gif"}, "www.mysite.com"
>
> > but of course, that won't work.
> > Could I get some help?
>
> > -c.
--~--~---------~--~----~------------~-------~--~----~
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=en
-~----------~----~----~----~------~----~------~--~---