[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: building a gallery layout
From:       Sam Mayes <codeslave () gmail ! com>
Date:       2005-08-31 20:02:57
Message-ID: 4f26c97b05083113023183a95b () mail ! gmail ! com
[Download RAW message or body]


ok here is what i did may not be the most elegant but it works. thanks for 
the help. any Ideas to make it better are welcome.

<table>
<tr>
<th>Company</th>
</tr>
<% counter = 0 %>
<% 5.times do %>
<tr>
<% 5.times do %>
<% if @systems[counter] %>
<td>
<table>
<tr>
<td><%= @systems[counter].company.name %></td>
<td><%= @systems[counter].model %></td>
<td><%= @systems[counter].sid %></td>
<td><%= @systems[counter].sm_img %></td>
</tr>
<% for price in @systems[counter].prices %>
<tr>
<td><%= price.price %></td>
<td><%= price.store_name %></td>
<td colspan="2"></td>
</tr>
<% end %>
</table>
</td>
<% else %>
<td></td>
<% end %>
<% counter+=1 %>
<% end %>
</tr>
<% end %> 


</table>


On 8/31/05, Josh Charles <josh.charles@gmail.com> wrote:
> 
> an array-less way to do it
> 
> pictures[]
> counter = 0
> 
> 5.times do
> puts "<tr>"
> 5.times do
> if ( pictures[ counter ] ) exists
> puts "<td>" + image code + "</td>"
> else
> puts "<td></td>"
> end
> counter ++
> end
> puts "</tr>"
> end
> 
> I think that is almost legal ruby code. I'm new to ruby, so I don't
> know exactly. There is probably an even better way of doing this.
> I'm really gray on ruby array handling
> 
>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic