开发者

How to prevent outputing the html label?

开发者 https://www.devze.com 2023-02-09 22:04 出处:网络
The code I currently have is: <h2 id=\"comment_title\">vistor comments</h2> <div class=\"count\">

The code I currently have is:

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

Now, i want to know how to alter the above code to get this effect:

When $count > 0, it should output the html label, and can use some css style to it.

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

When $count <= 0, don't output the html label. and don't use any css style to it.

<h2 id="comment_title">vistor commen开发者_运维知识库ts</h2> ;


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

精彩评论

暂无评论...
验证码 换一张
取 消