Kintaro Well-known member Jul 26, 2017 #1 In a template, I need to check if a variable is a string or a number. Is it possible? Thank you
Kintaro Well-known member Jul 26, 2017 #3 Chris D said: This should do it: {xen:dump $var} Click to expand... uhmm this will list all the information about $var, right? (I'm going to try) I need to use that info in a conditional: if $var is a string do this if is a number do that.
Chris D said: This should do it: {xen:dump $var} Click to expand... uhmm this will list all the information about $var, right? (I'm going to try) I need to use that info in a conditional: if $var is a string do this if is a number do that.
Chris D XenForo developer Staff member Jul 26, 2017 #4 Oh, in that case I think you can do this (un-tested, I think we expose it like this): Code: <xen:if is="is_string({$var})"> <xen:else /> </xen:if>
Oh, in that case I think you can do this (un-tested, I think we expose it like this): Code: <xen:if is="is_string({$var})"> <xen:else /> </xen:if>
Kintaro Well-known member Jul 26, 2017 #5 Thank you, Chris, in the meantime, I found also this: https://xenforo.com/community/threads/xen-if-is-or.20616/#post-263356 The problem is that I realized only now that the content $var could be a number but the variable type still a string.
Thank you, Chris, in the meantime, I found also this: https://xenforo.com/community/threads/xen-if-is-or.20616/#post-263356 The problem is that I realized only now that the content $var could be a number but the variable type still a string.