MyBB Community Forums

Full Version: Help with a If Statement
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I added a new custom field to my forum to track prize points and when it display a member prize points in the postbit I wanted it to put a 0 if they dont have any points, so I thought this bit of code would work ( this is with the php in template plugin added):


<if $post['fid6'] == '' then>
<func htmlspecialchars_uni>0</func>
<else />
{$post['fid6']}
</if>


But I keep getting a T_Parse error, can someone tell me what I am doing wrong please?
Please I need some help.
(2010-05-15, 12:02 AM)FBI Wrote: [ -> ]get this http://community.mybb.com/thread-31860.html

(2010-05-12, 04:33 PM)Avarice Wrote: [ -> ]Hi, I added a new custom field to my forum to track prize points and when it display a member prize points in the postbit I wanted it to put a 0 if they dont have any points, so I thought this bit of code would work ( this is with the php in template plugin added):


<if $post['fid6'] == '' then>
<func htmlspecialchars_uni>0</func>
<else />
{$post['fid6']}
</if>


But I keep getting a T_Parse error, can someone tell me what I am doing wrong please?

It's already installed..
I am currently using this code:

<?php
if($mybb->user['fid6'] == ''){
echo "0";
}
else{
echo "{$post['fid6']}";
}
?>

I can't get it so that only the members with nothing in that custom field, have a 0.
Right now its saying everyone has nothing in the fid6, it's rather frustrating lol..