I have a TV with type of Checkbox.
It’s called ‘fullyBooked’, and the input value is ‘yes==1’.
in my template I have this:
[[*fullyBooked:is=`1`:then=`show this HTML`]]
But when the TV is checked, it doesn’t show anything.
I must be missing something obvious, but i’ve spent ages trying to work it out - I think it’s a friday feeling, but any pointers as to why?
Is this MODX tag nested in other tags? NO
Does the TV have an “Output Type” settings that is different from Default? NO
Maybe yes==1 contains some whitespace in the TV settings. I CHECKED AND NO
So if I put this in my template:
[[*fullyBooked:is=`1`:then=`show this HTML`]]
it works.
but if I use the actual html I want to show:
[[*fullyBooked:is=`1`:then=`
<div class="fullyBooked">
<div>
<h2 class="mb20">We are fully booked.</h2>
<p>Bookings for [[!+nowdate:default=`+2 month`:date=`%B %Y`]] will be available on the 1st [[!*nowdate:default=`+1 month`:date=`%B`]] at 7pm.</p>
</div>
</div>
`]]
It doesn’t work! It tuns out that the reason it’s not working is due to the date code:
[[!+nowdate:default=`+2 month`:date=`%B %Y`]]
If I remove this - it works.
Any ideas why this is?
With the MODX parser, it always gets tricky when there is an uncached tag inside a cached tag. Because embedded tags are parse before the surrounding tag, but cached tags are parsed before uncached tags, this creates a contradiction.
In this case it seems that MODX 3 can handle this kind of tag, but MODX 2 fails.
The solution is to either make the surrouding tag uncached as well
[[!*fullyBooked:is=`1`:then=`<p>Bookings for [[!+nowdate:default=`+2 month`:date=`%B %Y`]] ...</p>`]]
This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.