Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Search found 4 matches
Smarty Forum Index
Author Message
  Topic: how to use isset without generating notice ?
mmo

Replies: 5
Views: 8541

PostForum: General   Posted: Mon Dec 17, 2018 9:10 am   Subject: how to use isset without generating notice ?
test1:
{assign var='varname' value='nonexisting'}
{$varname}
is
{if isset(${$varname})}
set
{else}
not set
{/if}
output:
nonexisting is
( ! ) Notice: Undefined index: nonexisting in ...
...
  Topic: how to use isset without generating notice ?
mmo

Replies: 5
Views: 8541

PostForum: General   Posted: Thu Dec 13, 2018 7:01 am   Subject: how to use isset without generating notice ?
Why are you using such convoluted constructs to begin with?


Sadly it's the way I get the data. It's an old shop system, using multiple templates, and I can not change the basic data structure wit ...
  Topic: how to use isset without generating notice ?
mmo

Replies: 5
Views: 8541

PostForum: General   Posted: Wed Dec 12, 2018 7:42 am   Subject: workaround
It seems to use default like

{if ${$varname}|default:""}

is a usable workaround...
  Topic: how to use isset without generating notice ?
mmo

Replies: 5
Views: 8541

PostForum: General   Posted: Tue Dec 11, 2018 3:24 pm   Subject: how to use isset without generating notice ?
I get notices when using isset!

Simple example:

{assign var="varname" value="name_of_non_existing_variable"}
{$varname} is {if isset(${$varname})} set {else} not set {/if}
...
 
Page 1 of 1
All times are GMT
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP