I'm listing some movies in my web so the user can choose the best movie.
I’m classifying them by genre.
But the lists under each genre are too long and I want to make two columns of titles.
The number of movies in each column will depend of the genre.
So my code is like this now:
$i = 1;
echo "<ul>";
foreach($arrayMovies as $k=>$v)
{
echo "<li><input type=\"checkbox\" id=\"flat-$i\" name=\"$genre-$i\" value=\"$k\">
<label for=\"flat-$i\">$v</label></li>";
$i++;
}
echo "</ul>";
This code is showing the long list, something like this for drama:
Forest Gump
The Hours
Mullholand Drive
Titanic
.
.
Let’s say that for the drama genre I need two titles per column:
<ul>
<li> Forest Gump</li>
<li> The Hours</li>
</ul>
<ul>
<li> Mullholand Drive</li>
<li> Titanic</li>
</ul>
How can achieve this with my code??
The second column I can achieve by using css, I just need a new <ul>
after two titles.
Please notice that the number two in -two titles per column- is a dynamic number*
*I’ll count how many rows per title each genre has to get a total number and then I’ll do half of it to get the number of titles per column (the number of titles in each genre is even)
Thanks very much!