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

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

Robbo

Well-known member
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.
 
Upvote 0
This suggestion has been closed. Votes are no longer accepted.
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 ''.
 
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...
 
Top Bottom