Frågan#1
Hej
Hittade en funktion (som jag gjorde om lite) här som delar upp en tabell i fler kolumner.
function wp_split2cols($colcontent, $columns) {
$coloutput = "";
$bodytext = array("$colcontent");
$text = implode(",", $bodytext); //prepare bodytext
$length = strlen($text); //determine the length of the text
$length = ceil($length/$columns); //divide length by number of columns
$words = explode(" ",$text); // prepare text for word count and split the text into columns
$c = count($words);
$l = 0;
for($i=1;$i<=$columns;$i++) {
$new_string = "";
$coloutput .= "<div class=\"divcols\">";
for($g=$l;$g<=$c;$g++) {
if(strlen($new_string) <= $length || $i == $columns)
$new_string.=$words[$g]." ";
else {
$l = $g;
break;
}
}
$coloutput .= $new_string;
$coloutput .= "</div>";
}
return $coloutput;
}
Det som dock inte funkar är om den innehåller html på fel ställe. Då sabbas divarna. Tips?
