Hi All, I need a php programmer for a minor change to a php classified script. The index page has a table in the center with all the main categories in 3 different columns. Under the main category is all the sub categories for each main category. This would be fine if all the main categories had the same amount of sub cats, they would fill out the table evenly, this is not the case. One of the main categories has 5 times the sub categories than the other categories. The script is set to have an equal number of main categories in each column. This is the problem. I need to be able to change the amount of categories in each column to make the table even out on the page. How can I change the code to have the table even out in all 3 columns? What can I change to make #1 column have X number of categories and column #2 to have X number of categories and column #3 to have X number of categories to even out the look of the table? Any help is greatly appreaciated. Thanks, dthbah2006
1. Let total = the number of categories you want to display on the page (i.e., 8) 2. Let cols = the number of columns you want (say 3) 3. Calculate rows = ceil(total / cols) ... (i.e., ceil(8/3) = 3 4. Calculate realSize = cols * rows (i.e. 3*3 = 9) So you really want 9 cells. Pad out the array of categories accordingly, the array currently has 8 elements so add 1 empty one to make it 9. And add a little bit of logic where if the array element is empty or null, just draw a blank table cell (<td> </td>) instead of the table cell with the category link in it. That's how to do it. Can't provide any code without seeing the script.
Thanks Robert for the suggestion. I need to hire a PHP coder to correct the problem. Anyone interested in the project please PM me. Thanks, dthbah2006