Some time ago I was stuck on an issue and couldn't resolve it.
It was this:
No matter what I tried I couldn't get that to save so ended up going with a different approach, which was:
Since then it has bugged me why I couldn't get that to work in a single line of code in XF2, when it was possible in XF1.
Fast forward several months and today I was trying out some other stuff and to my surprise this worked:
I didn't understand why at first and then noticed a very subtle difference between the two lines of code.
The original one has a space in the end group of brackets -
So the original line of code does of course work if the space is removed like so:
A bit late but at least now I can finally sleep at night.
It was this:
Code:
{$banner.{{ ($xf.time % 5) + 1 }} }
No matter what I tried I couldn't get that to save so ended up going with a different approach, which was:
Code:
<xf:set var="$int" value="{{ ($xf.time % 5) + 1 }}" />
{$banner.{$int}}
Since then it has bugged me why I couldn't get that to work in a single line of code in XF2, when it was possible in XF1.
Fast forward several months and today I was trying out some other stuff and to my surprise this worked:
Code:
{$banner.{{ rand(1,5) }}}
I didn't understand why at first and then noticed a very subtle difference between the two lines of code.
The original one has a space in the end group of brackets -
}} }
versus }}}
.So the original line of code does of course work if the space is removed like so:
{$banner.{{ ($xf.time % 5) + 1 }}}
.A bit late but at least now I can finally sleep at night.