a couple of advises :

if you do this

%td = ruby code

be careful not to ident it will cause an error


to output text and ruby code in the same line user this

=" normal text #{rubycode}"


to combine id and class on the fly user this

%anytag#idhere.classhere

like this %span#top.title

you can then put dome ruby code after = like this

%span#top.title= product.name

or like this

%span#top.title = "Name #{product.name}"

to create dinamic id in a div tab user this

%div{:id=>"product_#{product.id}"}

normally calling #product will make haml assume is a div
and you done need to add %div at beginning  so this

#product
  =product.name

is the same as

%div#product
  product.name

and the same as

%div{:id=>"product"}





On Mon, Sep 6, 2010 at 11:45 AM, sol.manager <[email protected]> wrote:

> Thank you so much. I have been all over the examples, but still feel
> like a dog chasing a car. Now I can see why mine code wasn't working
> and I appreciate the assistance.
>
> On Sep 6, 11:29 am, Hampton <[email protected]> wrote:
> > Should be more like this:http://pastie.org/1141671
> >
> > I haven't tested it... but you don't use <% end %> or <% <%= %> at all!
> >
> > End's are assumed. Check out haml-lang.org for plenty of examples!
> >
> > -hampton.
> >
> >
> >
> > On Mon, Sep 6, 2010 at 3:51 PM, sol.manager <[email protected]>
> wrote:
> > > I am new to this whole Haml thing as of last night and am very
> > > impressed. I tried switching over a simple .erb template to .haml and
> > > having a problem. I am guessing I didn't properly Haml the section
> > > below my / note. I have tried a few things but no luck. So, can anyone
> > > tell me what is wrong with the following? (this is all the code in my
> > > partial named /contacts/_contact.html.haml
> >
> > > %table
> >
> > >  %tr
> > >    %th avatar
> > >    %th contact name
> > >    %th city
> > >    %th email
> > >    %th mobile
> > >    %th phone
> > >    %th company name
> > >    %th action(s)
> >
> > >    / this and probably the remainin lines still need proper Haml
> > > markup. I am not doing something rite
> > >    <% @contacts.each do |contact| %>
> >
> > >  %tr
> > >    %th <%= image_tag contact.avatar, :class => 'img_avatar_thumb' %>
> > >    %th <%= contact.first_name %> <%= contact.last_name %>
> > >    %th <%= contact.city %>
> > >    %th <%= contact.email %>
> > >    %th <%= if !contact.mobile.blank? %><
> > > %=number_to_phone(contact.mobile, :area_code => true)%> <% end %>
> > >    %th <%= if !contact.phone.blank? %><
> > > %=number_to_phone(contact.phone, :area_code => true)%> <% end %>
> > >    %th <%= contact.company_name %>
> > >    %th <%= link_to image_tag("/images/buttons/
> > > ico_buscard.png", :alt=>"Show contact card"), contact %> <%= link_to
> > > image_tag("/images/buttons/ico_edit.png", :alt=>"Edit contact"),
> > > edit_contact_path(contact) %> <%= link_to image_tag("/images/buttons/
> > > ico_delete.png", :alt=>"Delete contact"), contact, :confirm => 'Are
> > > you sure?', :method => :delete %>
> > > <% end %>
> >
> > > --
> > > 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 athttp://
> groups.google.com/group/haml?hl=en.
>
> --
> 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=en.
>
>

-- 
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.

Reply via email to