dede
dede

Reputation: 31

smarty help with if statement

I tried this code:

{if $login_status eq '1' }
    <a href="{$html_header.base_url}login.php?logout " >Logout </a>
{/if}

and passed the value {$login_status=1}.

This causes:

Uncaught exception 'SmartyCompilerException' with message 
'Syntax Error in template "tmpl\admin_login.tpl"  on line 2 "{if $login_status eq '1' }"  - Unexpected " }"' in C:\wamp

Which is not working. What am I doing wrong ?

Upvotes: 0

Views: 187

Answers (2)

Karolis
Karolis

Reputation: 9562

I think it's because of the space before the ending bracket.

Upvotes: 0

Paul DelRe
Paul DelRe

Reputation: 4039

There shouldn't be a difference, but have you tried any of these below? What you have included looks correct.

{if $login_status == '1'}
{if $login_status == 1}
{if ($login_status == '1')}

I'm assuming that {html_header.base_url} is a custom function of yours. I would just want to eliminate the question if it's causing any problems by replacing it with something static until you solve the {if} issue.

Upvotes: 1

Related Questions