I have a joke site where i have more than 5,000 jokes in a miscellaneous jokes category and it tries to display a paging result: page 1, 2, 3, etc all the way up to 138 which puts the template out of shape. the code using for the paging is this <? if($page > 1){ $prev = ($page - 1); echo "<a href='".get_cat_url($id,$prev,$make)."'><<Previous</a> "; } for($i = 1; $i <= $total_pages; $i++){ if(($page) == $i){ echo "$i "; } else { echo "<a href='".get_cat_url($id,$i,$make)."'>$i</a> "; } } // Build Next Link if($page < $total_pages){ $next = ($page + 1); echo "<a href='".get_cat_url($id,$next,$make)."'>Next>></a>"; } ?> Code (markup): i tried putting the code inside a table with a fixed width of 275px hoping that the results would go up to a width of 275, then continue on the next line down, but all it wants to do is one continuous long line of results. <table width="275" border="0" cellspacing="0" cellpadding="0"> <tr> <td><? if($page > 1){ $prev = ($page - 1); echo "<a href='".get_cat_url($id,$prev,$make)."'><<Previous</a> "; } for($i = 1; $i <= $total_pages; $i++){ if(($page) == $i){ echo "$i "; } else { echo "<a href='".get_cat_url($id,$i,$make)."'>$i</a> "; } } // Build Next Link if($page < $total_pages){ $next = ($page + 1); echo "<a href='".get_cat_url($id,$next,$make)."'>Next>></a>"; } ?></td> </tr> </table> Code (markup): Can someone suggest a fix either with the table code or the paging result code. Thanks in advance.
Tried using <td style="width: 275px;"> Code (markup): but it didn't help it still displaying in one continuous line Any one else have any other ideas?
Try doing something with this: I see a lot of width:100%. Try changing them to fixed numbers and see if it fixes it. Also, you may want to try rewriting it using divs and CSS.
try this: <? if($page > 1){ $prev = ($page - 1); echo "<a href='".get_cat_url($id,$prev,$make)."'><<Previous</a> "; } // INCREASE OR DECREASE THIS VALUE AS YOU SEE FIT $max_per_row = 10; $cnt = 0; for($i = 1; $i <= $total_pages; $i++){ if(($page) == $i){ echo "$i "; } else { echo "<a href='".get_cat_url($id,$i,$make)."'>$i</a> "; } $cnt = $cnt + 1; if(($cnt % $max_per_row) == 0){ echo "<br>"; } } // Build Next Link if($page < $total_pages){ $next = ($page + 1); echo "<a href='".get_cat_url($id,$next,$make)."'>Next>></a>"; } ?> Code (markup): change $max_per_row to suit yourself...
LOL! I don't think you are talking out your a$$, i just didn't understand what you were trying to say, i understand html, but php and dynamic statements are way over my head.. Thanks for your help also +Rep to you as well.