bai
Junior Member
I coughed. Then I went into labor.
Posts: 209
inherit
tbsofficial@outlook.com
241711
0
Sept 23, 2018 14:23:39 GMT -8
bai
I coughed. Then I went into labor.
209
February 2017
bai
|
Post by bai on May 8, 2018 8:44:52 GMT -8
So I wrote out this code but can't seem to get the avatar to display. What am I doing wrong here?
<tr><td colspan="2"> <br><b>Board Moderators</b> {if $[board.moderators]}<tr><td><br>{foreach $[board.moderator]} $[board.moderator.avatar_small] {/foreach} </td></tr>{/if}</td></tr>
Even without the extra tr/td surrounding the avatar it doesn't come up. And when I put an "{else} None" if there aren't any board mods, it just displays None.
|
|
Nori
Junior Member
Posts: 483
inherit
182806
0
Nov 16, 2024 21:35:22 GMT -8
Nori
483
September 2012
nori
|
Post by Nori on May 8, 2018 9:44:20 GMT -8
Hullo!
Try changing your If statement to check against {if $[board.num_mods]} instead.
|
|
bai
Junior Member
I coughed. Then I went into labor.
Posts: 209
inherit
tbsofficial@outlook.com
241711
0
Sept 23, 2018 14:23:39 GMT -8
bai
I coughed. Then I went into labor.
209
February 2017
bai
|
Post by bai on May 8, 2018 10:02:30 GMT -8
Hullo! Try changing your If statement to check against {if $[board.num_mods]} instead. I'm not sure if this is what you meant, but when I changed it to the following, it only displays the number of boards mods rather than the avatars. {if $[board.num_mods]}<tr><td><br>$[board.moderator.avatar_small]</td></tr>{/if}
|
|
#eb7100
33409
0
1
Nov 24, 2024 4:27:37 GMT -8
Brian
48,130
November 2004
smashmaster3
|
Post by Brian on May 8, 2018 13:34:29 GMT -8
{if $[board.num_mods]} is meant to replace {if $[board.moderators]} in the template code you initially posted. No other changes to the code are required to get the if statement and foreach loop working.
$[board.moderators] isn't a real variable while $[board.num_mods] is which is why your if statement was initially failing.
|
|
bai
Junior Member
I coughed. Then I went into labor.
Posts: 209
inherit
tbsofficial@outlook.com
241711
0
Sept 23, 2018 14:23:39 GMT -8
bai
I coughed. Then I went into labor.
209
February 2017
bai
|
Post by bai on May 8, 2018 15:07:08 GMT -8
Makes sense! Thanks for the lesson!
|
|