引导程序如果是秩系统的声明

时间:2014-01-18 22:50:23

标签: php image twitter-bootstrap rank

我正在尝试在Bootstrap中添加一个语句,基本上如果用户发布的内容超过10(例如),那么就是排名图像。我确实有以下声明:

{if $userArray.UserPosts > 0}
                                            <span id="headerWelcomeRank">
                                            {if $userArray.UserPosts < 10}
                                                {$translate->__("Cadet")}
                                            {elseif $userArray.UserPosts < 25}
                                                {$translate->__("Ensign")}
                                            {elseif $userArray.UserPosts < 50}
                                                {$translate->__("Lt JG")}
                                            {elseif $userArray.UserPosts < 100}
                                                {$translate->__("Lt")}
                                            {elseif $userArray.UserPosts < 200}
                                                {$translate->__("Lt Commander")}
                                            {elseif $userArray.UserPosts >= 300}
                                                {$translate->__("Commander")}
                                            {elseif $userArray.UserPosts >= 400}
                                                {$translate->__("Captain")} 
                                            {/if}
                                            </span>
                                        {/if}

但那没用。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

你在写什么语言?您的帖子被标记为PHP,因此这是您在PHP中的代码:

<?php
$userPosts = $userArray["UserPosts"]; // Or however you get their post count.
if ($userPosts > 0) {
    echo "<span id=\"headerWelcomeRank\">";
    if ($userPosts < 10) {
        $translate->__("Cadet")
    } elseif ($userPosts < 25) {
        $translate->__("Ensign");
    } elseif ($userPosts < 50) {
        $translate->__("Lt JG");
    } elseif ($userPosts < 100) {
        $translate->__("Lt");
    } elseif ($userPosts < 200) {
        $translate->__("Lt Commander");
    } elseif ($userPosts >= 300) {
        $translate->__("Commander");
    } elseif ($userPosts >= 400) {
        $translate->__("Captain");
    }
    echo "</span>";
}

如果您的问题仍然存在,可以提供您的实际输出,并确认您是否尝试使用PHP或Smarty或其他更好的方法。