Ciao ho uno script che mi produce un output con diverse news che vengono incolonnate l'una sotto l'altra. Adesso avrei bisogno che i div centrali invece che messi uno sotto l'altro, fossero alternati a sx e a dx (in base al loro numero) sfruttanto lo style="float:left" e "float:right".

mi potreste dare una mano?
grazie.




codice:

// Leading story output 
                if ( $leading ) {
                        echo '<div>';
                        echo '<div>';
                        for ( $z = 0; $z < $leading; $z++ ) {
                                if ( $i >= $total ) {
                                        // stops loop if total number of
items is less than the number set to display as leading
                                        break;
                                }
                                echo '<div>';
                                show( $rows[$i], $params, $gid, $access,
$pop, $option, $ItemidCount );
                                echo '</div>';
                                $i++;
                        }
                        echo '</div>';
                        echo '</div>';
                }

                if ( $intro && ( $i < $total ) ) {
// ALTRI ELEMENTI COLONNE ECC.
                        echo '<div>';
                        echo '<div>';
                        echo '<div>';
                        // intro story output
                        for ( $z = 0; $z < $intro; $z++ ) {
                                if ( $i >= $total ) {
                                        // stops loop if total number of
items is less than the number set to display as intro + leading
                                        break;
                                }

                                if ( !( $z % $columns ) || $columns == 1 ) {
                                        echo '<div>';
                                }


                                echo '<div '. $width .'>';

                                // outputs either intro or only a link QUESTA FUNZIONE SHOW MOSTRA GLI OUTPUT CHE VORREI METTERE A SX E A DX, INVECE LI METTE L'UNO SOTTO L'ALTRO
                  
                                if ( $z < $intro ) {
                                        show( $rows[$i], $params, $gid,
$access, $pop, $option, $ItemidCount );
                                } else {
                                        echo '</div>';
                                        echo '</div>';
                                        break;
                                }

                                echo '</div>';

                                if ( !( ( $z + 1 ) % $columns ) || $columns
== 1 ) {
                                        echo '</div>';
                                }

                                $i++;
                        }

                        // this is required to output a final closing </tr>
tag when the number of items does not fully
                        // fill the last row of output - a blank column is left
                        if ( $intro % $columns ) {
                                echo '</div>';
                        }

                        echo '</div>';
                        echo '</div>';
                        echo '</div>';
                }