If $TotEarn = 893.5 , what part of your if-elseif-else should be executed? Put some echoes in there to watch the flow.
What becomes blank? You don’t see anything on the screen? Maybe you’re telling Smarty to do zero surpression (a zero values is displayed as blank) ? I don’t know Smarty, so I’m just guessing here.
Do an echo of $HDMF after the if-elseif-else to check its value.
Yeah, didn’t mean to sound so preachy there, just saying its fine to make errors like that as long as you address the underlying cause – and sometimes there is a bonus to naming variables longhand – yes, they seem to take up more space but reading
$highDensityMoneyFactor = 0;
might be more:
meaningful to someone else
meaningful to you in three months time
and if you have a good IDE (or you train your text editor, like Vim) it will code complete for you.
Then again you might simplify it to $bonus.
If you find that way of thinking to be in any way at all cool or helpful then you might like to get hold of a copy of “Clean Code” by Uncle Bob Martin as your xmas treat (nods to Anthony Sterling ).