0

I have a list:

IMAGE HERE - CLICK

Here is a code:

$main_content .= '<div class="InnerTableContainer" >          
                     <table style="width:100%;" >
                     <tr>';
                     if(count($config['site']['newchar_vocations']$world_id]) > 1) {
                        $main_content .= '<td><table class="TableContent" width="100%" >
                                         <tr class="Odd" valign="top">
                                                <td width="160"><br /><b>Select your vocation:</b></td>
                                                <td><table class="TableContent" width="100%" >';
                         foreach($config['site']['newchar_vocations'][$world_id] as $char_vocation_key => $sample_char) {
                             $main_content .= '<tr><td><input type="radio" name="newcharvocation" value="'.$char_vocation_key.'" ';
                             if($newchar_vocation == $char_vocation_key)
                                $main_content .= 'checked="checked" ';
                                $main_content .= '>'.htmlspecialchars($vocation_name[0][$char_vocation_key]).'</td></tr>';
                         }
                        $main_content .= '</table></table></td>';

It's taking the names to the list from this config:

$config['site']['newchar_vocations'][0] = array(
  1 => 'Goku Sample',
  17 => 'Vegeta Sample',
  32 => 'Piccolo Sample',
  45 => 'C17 Sample',
  57 => 'Gohan Sample',
  71 => 'Trunks Sample',
  83 => 'Cell Sample',
  95 => 'Freeza Sample',
  111 => 'Majin Boo Sample',
  140 => 'C18 Sample',
  206 => 'Dende Sample',
  244 => 'Kuririn Sample',
  256 => 'Pan Sample',
  292 => 'Janemba Sample',
  304 => 'Tenshinhan Sample', 
  280 => 'Videl Sample', 
  316 => 'Jenk Sample', 
  192 => 'Cooler Sample', 
  328 => 'Raditz Sample', 
  340 => 'C16 Sample', 
  352 => 'Turles Sample', 
  364 => 'Bulma Sample', 
  230 => 'Bardock Sample', 
  268 => 'Kaio Sample', 
  178 => 'Chibi Trunks Sample', 
  152 => 'Uub Sample' 
);

How to divide this list to for example 3 parts? For example 6 values per part? Like this:

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
dawidurusek
  • 113
  • 1
  • 1
  • 11

1 Answers1

0

You can arrange your list with three columns only with CSS code. You can see an example here :

.col {
   -webkit-columns: 3;
   -moz-columns: 3;
   columns: 3;
}
  
p {
   margin: 0;
   background: #F0F0F0;
}
<div class="col">
  <p>A....</p>
  <p>B....</p>
  <p>C....</p>
  <p>D....</p>
  <p>E....</p>
  <p>F....</p>
</div>

It's one of many possibilities

arnolem
  • 946
  • 1
  • 6
  • 8