M
M
Maxim Spiridonov2014-09-08 16:31:18
PHP
Maxim Spiridonov, 2014-09-08 16:31:18

How to correctly write a condition in the smarty template engine?

Hello, there was a problem with composing a condition in smarty, namely this.

{if isset($_SESSION['id'])}
Вы успешно авторизовались!
{elseif empty($_SESSION['id'])}
{$auth}
{/if}

I am trying to do the following. If there is a session (id), then display the text about successful authorization, and if the session does not exist, then display the form for authorization. I read the documentation, but I did not think of it because of what nothing is displayed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kafeuri1, 2014-09-08
@kafeuri1

{if isset($smarty.session.id)}
You have successfully logged in!
{else}
{$auth}
{/if}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question