In the following code, a string should be exploded into an array. A for loop goes through this array and starts counting charachters.
Once wenough words pass the 15 charcater mark, a break statement is shown and the character counter resets.
In theory, this should create multiple lines of 15 chars or less, but it stops addeing the break statements after the first time through and I;m not sure why.
I have the code for that section of the code. Any eyeballing would be greatly appreciated.
$articleNameArray = explode(" ",$subrow['NAME']);
$arraySize = sizeof($articleNameArray);
$charCount = 0;
$outputName = "";
for ($i=0; $i<$arraySize; $i++){
$charCount = $charCount + strlen($articleNameArray[$i]);
if ($i == 0){
$outputName .= addslashes($articleNameArray[$i]);
}else{
if ($charCount > 15){
$outputName .= "<br> ";
$charCount = 0;
}
$outputName .= " ".addslashes($articleNameArray[$i]);
}
}
echo "d.add(".$total_counter.",".$current_category.",'".addslashes($outputName)."','blissful.php?topic=".$subrow['SID']."&article=1');\n";
$total_counter++;