For the div, the attribute hash has to be right next to the tag name -
like so:
%div{ :id => "track.id" }
Flash-Loading error -> Alternate content
Otherwise Haml thinks it's just text that should be put within the tag.
For the Javascript, use the :javascript filter:
:javascript
var s1 = new SWFObject("/flash/player_4_0_48.swf","player","270","20","9");
s1.addParam("allowfullscreen","true");
s1.addParam("allowscriptaccess","always");
s1.addParam("wmode","opaque");
s1.addParam("flashvars","file=/tracks/data/#{track.id}&fullscreen=false&type=sound");
s1.write("#{track.id}");
- Nathan
j0llyr0g3r wrote:
> Hey folks,
>
> i read the documentation and transformed "most" of my ERBs to HAML but
> i still don't know how to interpolate view / controller variables in
> HAML.
>
> This is the part from my ERB i want to transform into HAML:
>
> CODE:
>
> <ul>
> <% @tracks.each do |track|%>
> <li><%= track.title %></li>
>
> <br/><br/>
>
> <div id="<%= track.id %>">Flash-Loading error -> Alternate content</
> div>
> <br/>
>
> <script type="text/javascript">
>
> var s1 = new SWFObject("/flash/
> player_4_0_48.swf","player","270","20","9");
> s1.addParam("allowfullscreen","true");
> s1.addParam("allowscriptaccess","always");
> s1.addParam("wmode","opaque");
> s1.addParam("flashvars","file=/tracks/data/<%= track.id
> %>&fullscreen=false&type=sound");
> s1.write("<%= track.id %>");
> </script>
>
> Now there are two code-snippets which i can't transform to HAML:
>
> 1.
> <div id="<%= track.id %>">
> 2.
> s1.addParam("flashvars","file=/tracks/data/<%= track.id
> %>&fullscreen=false&type=sound");
> s1.write("<%= track.id %>");
>
> For example, i tried this (regarding 1.):
>
> %div { :id => "track.id" }
> Flash-Loading error -> Alternate content
>
> but then i get: Illegal nesting: content can't be both given on the
> same line as %div and nested within it.
>
> Thanks for every help!
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---