Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/236.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 秩系统的引导If语句_Php_Image_Twitter Bootstrap_Rank - Fatal编程技术网

Php 秩系统的引导If语句

Php 秩系统的引导If语句,php,image,twitter-bootstrap,rank,Php,Image,Twitter Bootstrap,Rank,我试图在Bootstrap中添加一个语句,其中基本上如果用户的帖子超过10(例如),那么就添加一个排名图像。我确实有以下声明: {if $userArray.UserPosts > 0} <span id="headerWelcomeRank"> {if $userArray.UserPosts <

我试图在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}
{if$userArray.UserPosts>0}
{如果$userArray.UserPosts<10}
{$translate->(学员)}
{elseif$userArray.UserPosts<25}
{$translate->{(“Ensign”)}
{elseif$userArray.UserPosts<50}
{$translate->(Lt JG)}
{elseif$userArray.UserPosts<100}
{$translate->(Lt)}
{elseif$userArray.UserPosts<200}
{$translate->(中校指挥官)}
{elseif$userArray.UserPosts>=300}
{$translate->(指挥官)}
{elseif$userArray.UserPosts>=400}
{$translate->(船长)}
{/if}
{/if}

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

你用什么语言写的?您的帖子被标记为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>";
}