Dynamic columns and Flexy again

From: Date: Mon, 10 Oct 2005 05:35:35 +0000
Subject: Dynamic columns and Flexy again
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21303@lists.php.net to get a copy of this message
Hi there, I had asked some questions earlier regarding formatting an array pulled from the database to generate dynamic columns in flexy to a given column length. Is there still no method in flexy to handle this automatically ? Ive had no luck trying to format an array i get from the db using MDB2 like $db->queryAll('select * from table'); Im needing to slice that up into say 2 columns and however many rows needed, im trying to hack this up as there seems to be no method, however is a lesser block based templating system i used years ago it had the column function ?? Any ideas ?? $i = 0; $this->ar = array(); $arr = array(0=>array('title'=>'test1'),1=>array('title'=>'test2'),2=>array('title'=>'test3'),3=>array('title'=>'test4'),4=>array('title'=>'test5'),5=>array('title'=>'test6'),6=>array('title'=>'test7'),7=>array('title'=>'test8'),8=>array('title'=>'test9'),9=>array('title'=>'test10'),10=>array('title'=>'test11')); $cols = 2; $loop = ceil(count($arr) / $cols); $r = 0; for ($j=0;$j <= $loop;$j++) { $this->ar[$i % $cols == 0 ? $i++ : $i] = array_slice($arr,$j + $cols,$cols,true); }

« previous php.pear.general (#21303) next »