kalo algoritma nya kayak gini:
*table
tr
td
each.photo do |f|
print photo.f
if f==5{
print /tr
print tr
print td
}
end if
/td
/tr
/table *
coba pas di bagian
* each.photo do |f|
print photo.f
if f==5{
print /tr
print tr
print td
}
end if
*diganti jadi
@photos.each_with_index do |f, i|
print photo.f
------
if *i*==5{
print /tr
print tr
print td
}
end if
--------
semoga berhasil.
:-)
-Feby
2008/10/31 doni <[EMAIL PROTECTED]>
> --------------Default koding yang sudah dibuat ----------------
>
> <% if @photos.blank? %>
> <P> TIDAK PHOTO</P>
>
> <% else %>
>
> <center>
>
> <table>
> <tr>
> <% @photos.each do |c| %>
> <td>
> <%= image_tag(url_for({:action => 'image', :id => c.id}),:width
> =>'130', :height =>'86' ) %><br>
> <%= link_to "lihat" , {:action => 'show2', :id => c.id} -%>
> <% if logged_in? %>
> <small> <%= link_to 'Edit', {:action => "edit2", :id => c.id }
> %></small>
> <small> <%= link_to 'Delete', {:action => "delete2", :id =>
> c.id }, :confirm => "apakah anda yakin mau mengapus photo ini?" %></small>
> <% end %>
> </td>
>
> <% end %>
> </tr>
>
> </table>
> </center>
>
> <% end %>
>
> -----------------END koding ----------------------------------
>
> kasus ini saya bingung pada saat mengatur photo
>
> yang saya inginkan output photo yaitu seperti ini
>
> (photo)|(photo)|(photo)|(photo)|(photo)| setelah 5 photo maka pindah
> ke baris baru
> (photo)|(photo)|(photo)|(photo)|(photo)|
> (photo)|(photo)|(photo)|(photo)|(photo)|
> (photo)|(photo)|(photo)|(photo)|(photo)|
>
> tapi hasilnya satu baris aja
>
>
> (photo)|(photo)|(photo)|(photo)|(photo)|(photo)|(photo)|(photo)|(photo)|(photo)|(photo)|
>
> algoritma yang saya dapat :
>
> table
> tr
> td
>
> each.photo do |f|
> print photo.f
>
> if f==5{
>
> print /tr
> print tr
> print td
> }
> end if
> /td
> /tr
> /table
>
> yang saya bingung pada saat koding railsnya ...
> mohon bantuan untuk kodingnya
>
>
>
[Non-text portions of this message have been removed]