generate HTML table with variable number of columns and rows |
[eluser]Brain Coder[/eluser]
hello every one i have a problem here in the viewer i want to display result of the sql query and using it in html table this is my view Code: if($category['cat_active'] == 'active'){ i want to make in each row 4 td i got this lesson and trying to make it work with me but its isnt http://www.toppa.com/2008/generating-htm...-and-rows/ have any one an idea about this ?
[eluser]jedd[/eluser]
Hi Brain, What is the format of this $subcat variable that you refer: Code: if (count($subcat)){ Rather than this: Code: echo anchor("smylat/category/$list[cat_id]","$list[cat_name]") ; Code: echo anchor("smylat/category/". $list[cat_id] , $list[cat_name]) ; And finally, to help us help you, tell us not only what output you expect, but also what you're actually getting. This is more useful than saying 'it doesn't work'.
[eluser]Brain Coder[/eluser]
Welcome Jedd The variable $subcat is an array of the category that have a root category and the controller function is Code: function category($id = 0){ the problem in the veiw is "when the subcat more than 6 or 7 or 8 subcat the table isnt splited " i want to split the the td by the row this is a pic for what i want http://www.9amem.com/pics/1.gif note that the viewer just view the first index of array "first sub category" and this pic for what i have in viewer http://www.9amem.com/pics/2.gif
[eluser]jedd[/eluser]
So you just want to force a new row (TR) or even just a linebreak (BR), is that right? Can you do something like this (or am I way off the mark?) Code: $i = 0;
[eluser]Brain Coder[/eluser]
I love you man its work thank you very much i will do the same thing when i want to show the images under the category and using this library of pagenation http://codeigniter.com/wiki/AJAX_Paginat...n_Library/ is it good ?
[eluser]jedd[/eluser]
Quote:http://codeigniter.com/wiki/AJAX_Paginat...n_Library/ It is good. Now, with that code - glad it's what you were after - but I suggest that you don't hard-code in the number 4 anywhere. Instead set it as an entry in your config.php file - it'll make it easier to change. You can then get funky with it (later) and assess how many entries across you want to show - based on the size of each entry (strlen() counts) or the size of the user's browser window (bit tricky - think you need JS for this) and so on.
[eluser]Brain Coder[/eluser]
yes thats right but in this time i just want to show 4 td in each tr just take look here if the resolution was 800*600 http://www.9amem.com/pics/3.gif |
Welcome Guest, Not a member yet? Register Sign In |