ianaz
ianaz

Reputation: 2580

Smarty if statement

First time I use smarty so please don't be evil.. hope that someone could help me with this problem. I have the following code in page.tpl:

{$user-status}
{if $user-status == '-'}
    <h1>OK</h1>
{/if}

When the page is loaded, I see

"user-status-string" // this is correct
    {if $user-status == '-'}
        <h1>OK</h1>
    {/if}

It shows exactly the code as I have written, though above shows the correct variable attribute. Does someone know what i am doing wrong?

Thank you

Upvotes: 1

Views: 652

Answers (1)

Maxime Pacary
Maxime Pacary

Reputation: 23041

I guess that naming a variable with a dash can lead to unwanted behavior from Smarty.

Try to assign and use a variable named $userStatus for example.

Upvotes: 6

Related Questions