2011-04-09 93 views
0

我有一個奇怪的問題。我有一個動態網站www.lamanscanada.com它看起來很好,在Firefox和Safari瀏覽器,幾乎完美的IE7。但似乎在某些PHP生成的HTML。在函數輸出後添加了一堆空間。我也使用mod_rewrite爲好SEO網址只是一個說明。PHP生成HTML後的奇怪空格

的函數對數據的陣列成列子彈

<?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\">&bull;&nbsp;$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 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 
} 
?> 
+0

你明白這個問題的固定或者你還想就這個問題的幫助? – 2011-04-12 11:08:49

回答

0

<span class="features"><span class="featureitem">標籤所生成的列表的結束沒有被關閉。

電流產生的輸出:

<div class="infoblock"> 
    <div class="infoheading">features</div> 
    <span class="features"> 
     <span class="featureitem">&bull;&nbsp;10'X6'X8' Aluminum Extrusion Structure</span> 
     <span class="featureitem">&bull;&nbsp;R18 Insulated Panels</span> 
     ... 
</div> 

需要是:

<div class="infoblock"> 
    <div class="infoheading">features</div> 
    <span class="features"> 
     <span class="featureitem">&bull;&nbsp;10'X6'X8' Aluminum Extrusion Structure</span> 
     <span class="featureitem">&bull;&nbsp;R18 Insulated Panels</span> 
     ... 
    </span> 
</div> 
+0

哇這些事情之一....有時你需要的是一個新的眼睛,非常感激。 – Laurence 2011-04-15 01:39:19