Weird Spaces After PHP Generated HTML
I have a weird issue. I have a dynamic website www.lamanscanada.com it appears fine in firefox and safari and almost perfect in IE7. But it appears that on certain php generated html. There is a bunch of space added after the function output. I also user mod_rewrite for nice SEO urls just a note.
The function sorts an array of data into columns with bullets
<?php
//breaks array values into two columns
function groupBullets($array){
//count the array items
$bulletcount = count($array);
//divides that in two and round the result
$roundhalf = round(($bulletcount/2));
//initailize a counting variable
$i=1;
//loop throught the array
foreach($array as $bullet){
//if it is the first item
if($i==1){
echo "<span class=\"container\">";//open the main container div
}
echo "<span class=\"bullet\">• $bullet</span>";//then create bullet
//if the counter is at the half mark
if($i==$roundhalf){
echo "</span>";//close the container
$i=1;//and start the counter over
}else{
$i++;//if开发者_StackOverflow not at half keep counting
}
}
}
//end
//I am implementing it like this:
//this is my array it actually has a second level
$array = array(
columngroup01("bullet 1","bullet 2","bullet 3","bullet 4"),
columngroup02("bullet 1","bullet 2","bullet 3","bullet 4")
);
//I loop through this array
foreach($array as $column=>$arrayofbullets){
echo "<div class=\"columncontainer\">".//open the div contains the columns
"<div class=\"heading\">$column</div>";//print the title of the column
//use the groupBullets function on each array of bullets
groupBullets($arrayofbullets);
echo "</div>";//close the column container
}
?>
The <span class="features">
is not being closed at the end of the generated list of <span class="featureitem">
tags.
Current generated output:
<div class="infoblock">
<div class="infoheading">features</div>
<span class="features">
<span class="featureitem">• 10'X6'X8' Aluminum Extrusion Structure</span>
<span class="featureitem">• R18 Insulated Panels</span>
...
</div>
Needs to be:
<div class="infoblock">
<div class="infoheading">features</div>
<span class="features">
<span class="featureitem">• 10'X6'X8' Aluminum Extrusion Structure</span>
<span class="featureitem">• R18 Insulated Panels</span>
...
</span>
</div>
精彩评论