php css如何根据会员资格更改名称颜色?

i want to create member badges on evolutionscript forum

CSS :

.member_badge {
    padding: 5px;
    border: 1px solid #FFF;
    background: #EEE;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
}
.member_badge.admin {
    color: #000;
    background: #ee155d;
    border-color: #000;
}
.member_badge.moderator {
color: #FFF;
border-color: #050505;
background: #06e956;
}

here is the TPL file (forum_topic.tpl)

{if $item.member.forum_role != 1}
      <tr>
              <td>
                    <div class="member_badge">
                                {$item.member.membership}
                    </div>
              </td>
      </tr>
{/if}
         
     
{if $item.member.forum_role != 1 && $item.member.forum_role != 3}
      <tr>
              <td class="member_badge moderator">
                    {$item.frmgroup.name}
              </td>
     </tr>
{/if}

how to make this <td class="member_badge moderator"> if moderator logged

and how to set this <td class="member_badge ADMIN"> if admin logged using php ?

look the image to understand what i mean

Regards!

</div>

1个回答

I guess "{$item.member.membership}" is returning the user's group name, right?

Then try this:

CSS:

.member_badge {
    padding: 5px;
    border: 1px solid;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
}
.admin {
    color: #000;
    background: #ee155d;
    border-color: #000;
}
.moderator {
    color: #FFF;
    background: #06e956;
    border-color: #050505;
}

TPL:

{if $item.member.forum_role != 1}
      <tr>
              <td>
                    <div class="member_badge {$item.member.membership}">
                                {$item.member.membership}
                    </div>
              </td>
      </tr>
{/if}


{if $item.member.forum_role != 1 && $item.member.forum_role != 3}
      <tr>
              <td class="member_badge moderator">
                    {$item.frmgroup.name}
              </td>
     </tr>
{/if}
dqxboe2628
dqxboe2628 你欢迎我的朋友:)
接近 6 年之前 回复
doujiu3095
doujiu3095 非常感谢我并不认为我可以在CSS上包含PHP <td class =“member_badge {$ item.frmgroup.name}”>再次感谢
接近 6 年之前 回复
立即提问
相关内容推荐