$var($read)的结果导致文本更改颜色


Result of $var ($unread) cause text to change color

我有一个消息系统,它是在jquery移动网站中设置的,通过列表项作为菜单链接到它。在<li>中,设置为消息部分的链接的是消息未读计数。

<li>
 <a href='.../employee/msgsys/display_messages.php' target="_self">
    Messages (<?php echo ($unread);?>)
  </a>
</li>

我想做的是,当至少有一条新的未读邮件时,使邮件的文本和计数($read)变为红色。我在这里找了一些东西,但什么也没找到。有人有什么想法吗?

非常简单,不需要进入AJAX调用,这似乎就是您所需要的。

<li>
  <a href='...' target="_self" class="<?php echo count($unread)>0 ? "youve-got-mail" : ""; ?>">
    Messages (<?php echo ($unread); ?>)
  </a>
</li>

.youve-got-mail{
   color: red;
}