...

View Full Version : Question about tables



robenolt
11-01-2010, 11:00 PM
So I have a table with 6 columns and about 200 rows. The odd numbered rows all have cells with 60X60px images and all the even numbered rows have text. (so the first row has a picture and then under the picture is the name of the image). Everything must be ordered alphabetically. The problem is
that each time I want to add a new image I have to edit most of the coding. Is there a way to align tables in columns of six alphabetically without having to redo the most of the code each time? like maybe there is some type of script I can use? or is there an easier way to code it?
The code looks like this
<table border="1" bordercolor="#000000" cellpadding="0" width="450px">
<tr>
<td><img src=""></td>
<td><img src=""></td>
<td><img src=""></td>
<td><img src=""></td>
<td><img src=""></td>
<td><img src=""></td>
</tr>
<td>Name of the image</td>
<td>Name of the image</td>
<td>Name of the image</td>
<td>Name of the image</td>
<td>Name of the image</td>
<td>Name of the image</td>
</table>

teedoff
11-01-2010, 11:22 PM
Have you considered using a database and server side language to query and display these images and titles dynamically? Much easier and much less headache.

DrDOS
11-02-2010, 12:52 AM
It's very easy to automate the construction of tables with javascript, PHP or just about any language around. You put all the data in an array, which is very easy to write and edit, and a simple function takes the data and puts it in a table. Here's an example of a page using that.

http://ronbeau.50webs.com/utilities/escape-codes.html

You code will need to be a bit more sophisticated than that since it has to alternate rows. I would suggest putting the image and text in the same item in the array and using the split/explode function to separate them to simplify editing the array.

bazz
11-02-2010, 03:01 AM
I think the terms split and explode will have exactly that effect on the OP. lol

Basically you can learn a bit of javascript or better (in the medium and long-term), learn a server-side language. that will enable you to automate a lot of what you are tyring to do and make ongoing management easier.

bazz



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum