Announcement

Collapse
No announcement yet.

Problems with displaying incremental variables....

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • P1aGu3
    replied
    Ahhh Excellent ... Thanks very much for you help Ed

    Leave a comment:


  • Mike Sullivan
    replied
    Replace the "echo" with $stats .=

    Then reference $stats where you want it in your header.

    Leave a comment:


  • P1aGu3
    replied
    Its a Tribes2 Qstat Output

    The players, their score, and team are output raw from qstat like this ...

    Code:
    Herracon Eagle,,,0,,,0,,,TEAM,,,,,,
    Dragon Blade,,,0,,,1,,,TEAM,,,,,,
    Player1,,,0,,,1,,,Player,,,Bot,,,
    Player2,,,0,,,1,,,Player,,,Bot,,,
    etc
    etc
    Player1 = Field0[3]
    Player2 = Field0[4]

    i.e the field increases by one number for each line.

    I have a qstat.inc which does the explode (sorting the variables from the ,,, seperators).

    Normally I just
    Code:
    for ($i = 2 ; $i < $cct2->players->count ; $i++)
       {
       echo $cct2->players->field0[$i];
       echo $cct2->players->field3[$i];
       echo $cct2->players->field1[$i];
    }
    But Vbulletin wont allow direct echoing, so I have to find some way to recursively read, and display each variable incrementally.

    I hope that clears up my goal.

    Leave a comment:


  • Mike Sullivan
    replied
    Arrays or ".=" instead of "=" . I have no clue what you're trying to do, but this is probably how I'd do it:

    Code:
    for ($i = 2 ; $i < $cct2->players->count ; $i++)
       {
       $cct2players[]['something'] = $cct2->players->field0[$i];
       $cct2players[]['team'] = $cct2->players->field3[$i];
       $cct2players[]['score'] = $cct2->players->field1[$i];
    }

    Leave a comment:


  • P1aGu3
    replied
    Ok ... Since I am a PHP Newbie ... is there a way to display the variables in Vbulletin without having to write each variable for each player (up to 64 players, hence 64X3 variables)

    *sigh*

    I think I will have to do a variable for each player ... I hope not, think of the excess overhead.

    Leave a comment:


  • Mike Sullivan
    replied
    Well, you're just overwriting the same variable 20 times. Hence only the last stays.

    Leave a comment:


  • P1aGu3
    started a topic Problems with displaying incremental variables....

    Problems with displaying incremental variables....

    Code:
    for ($i = 2 ; $i < $cct2->players->count ; $i++)
       {
       $cct2players = $cct2->players->field0[$i];
       $cct2playerteam = $cct2->players->field3[$i];
       $cct2playerscore = $cct2->players->field1[$i];
    }
    This by rights should display about 20 players at the moment, but only shows the last player.

    It works in raw PHP in a single page, it displays all the players, teams, and scores, but when put into the Vbulletin PHP Parsed Code Template it only displays the last player, skipping all the ones previous.

    Am I missing something silly here ???
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X