user1561124
user1561124

Reputation: 17

smarty Error: Syntax Error in template

i have a session which is set thrugh php but when i try to get data using smarty i get following error

Error: Syntax Error in template "d:\server\theme\menu_inc.tpl" on line 10 "{if $smarty.session.user-permissions-ses.t_mgt == 1}" - Unexpected "."

smarty template code.

{if $smarty.session.user-permissions-ses.t_mgt == 1}
    information here
{/if}

I can't seem to know what might be causing this error.

Upvotes: 0

Views: 952

Answers (1)

John V.
John V.

Reputation: 4670

The problem is the hyphens, neither PHP nor smarty like to allow them in variables.

This should make it work though:

{if $smarty.session.{"user-permissions-ses"}.t_mgt == 1}
    information here
{/if}

Here is a thread on the Smarty forums with a little more information.

Upvotes: 2

Related Questions