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}


How to solve:

isset() – smartyphp



There you go!

{if isset($error)}


This is short 🙂
No warnings or errors.

{if $error}

Leave a Reply

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