php – How can I check if a variable exists in Smarty?-ThrowExceptions

Exception or error:

I’m using Smarty template engine.

I’m doing a simple login page. I set a variabile named error with a message if there are some problems, but IF NOT I get:

Notice: Undefined index: error

How could I check if this variable exists?

I only do:

{if $error}<h1>{$error}</h1>{/if}

thanks

How to solve:

isset() – smartyphp

isset($error)

Answer:

There you go!

{if isset($error)}

Answer:

This is short 🙂
No warnings or errors.

{if $error}

Leave a Reply

Your email address will not be published. Required fields are marked *