• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Lack of interest The way <xen:set> is compiled

Robbo

Well-known member
#1
The way <xen:set> is compiled sets the var specified to '' straight away. Is there any chance a $compileVar can be used instead and after the contents of the <xen:set> set it to whatever var was?

The reason for this is I couldn't work out why this code was giving me 2 every time.
Code:
<xen:set var="$row"><xen:if is="{$row} == 2">1<else />2</xen:if></xen:set>
Using a temp var while processing the contents would mean you could use the var within those contents if it exists and be handy for things like my example. I have to do this instead...
Code:
<xen:if is="{$row} == 2"><xen:set var="$row">1</xen:set><xen:else /><xen:set var="$row">2</xen:set></xen:if>
More code, harder to read etc.

Just sharing my annoyance and what would have stopped it from occurring.
 

Robbo

Well-known member
#3
That was a typo when making this post. Regardless of it missing it won't work anyway because of how it is compiled. It will always be set to 2 as $row will equal ''.
 

Robbo

Well-known member
#4
Having this issue again with something... forgot about it and now realize this still happens. I don't see why the compiler can't do if (!isset($var)) $var = ''; to init instead. I am having to store a temp var for it now...