HighDots Forums  

creating tables within a for loop

alt.html.writers alt.html.writers


Discuss creating tables within a for loop in the alt.html.writers forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dave Lynam
 
Posts: n/a

Default creating tables within a for loop - 12-24-2007 , 12:28 PM






I am programming a website in ruby on rails and I am having a problem
aligning tables within a for loop. I have a css element and within
that element a for loop in ruby. The code is as seen below:
<div id="friends">
<table border=1>
<% for user in @users -%>
<td>
<%= link_to
image_tag(user.avatar.public_filename(:tiny)) %>
</td><tr>
<td>
<%= user.screen_name %>
</td></tr>
<% end %>
</table>
</div>

This produces avatar thumbnails with the user screen name below it
which is great, but the cells are lined up wrong. They are lined up
vertically and after each loop it creates a new line so the avatars
are stacked on top of eachother. I want to line these up horizontally
so that I can have rows of avatar links within the css block. Does
anyone know how to do this? Any help is greatly appreciated! I am
totally stuck and have been working on this for days. Thanks.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.