2011-02-12 104 views
0

我目前擁有的代碼是:如何防止輸出html標籤?

<h2 id="comment_title">vistor comments</h2> 
<div class="count"> 
    <?php 
    $count = comment_num($nid); 
    if($count>0){ 
     echo $count'comments'; 
    } else { 
     echo '';   
    } 
    ?> 
</div> 

現在,我想知道如何改變上面的代碼來獲得這樣的效果:

$count > 0,它應該輸出HTML標籤,可以使用一些CSS風格。

<h2 id="comment_title">vistor comments</h2>and $count'comments'; 

$count <= 0時,不輸出html標籤。並且不要使用任何CSS樣式。

<h2 id="comment_title">vistor comments</h2> ; 
+1

`如果($計數> 0){//這裏把所有的東西你想呼應}`` – 2011-02-12 07:34:01

回答

0
<h2 id="comment_title"><?php echo $count?> visitor comments</h2></div>