Problem with snippet IF

I’ve made a template with nested If-function. Here is the code:

<div class="row">
[[!If?
&subject=`[[*img1]]`
&operator=`!empty`
&then=`<div class="col-sm-4 col-md-3"><div class="box mb-3">[[$modal1]] [[$modal2]] [[$modal3]]</div></div>
	[[!If?
	&subject=`[[*sidebar]]`
	&operator=`!empty`
	&then=`<div class="col-sm-5 col-md-6 mt-3">[[*content]]</div>
	<div class="col-sm-3"><div class="box mt-3">[[*sidebar]]</div></div>`
	&else=`	<div class="col-sm-8 col-md-9 mt-3">[[*content]]</div>`]]`

&else=`	
[[!If?
&subject=`[[*sidebar]]`
&operator=`!empty`
&then=`<div class="col-sm-8 col-md-9 mt-3">[[*content]]</div>
<div class="col-sm-4 col-md-3"><div class="box mt-3">[[*sidebar]]</div></div>`
&else=`<div class="col-12 mt-3">[[*content]]</div> `]]
`]]
</div>

It all works perfect until the text in [[*content]] exceeds 765 characters (including spaces). At that point the lay-out is completely ruined.
I really don’t know why. Has anybody here a clue? Or knows how to solve this?

I’m using MODX 3.03 and Bootstrap 5.2.

Hope someone can help me out.
Thanks
Leo

Maybe try applying this pull request and see if that helps:

Thank you for your quick response.

Unfortunately, I’m not a developer and I don’t understand what I can or should do with this. It’s beyond me. I therefore create two templates (one with sidebar and one without, then the nested if function is no longer necessary) instead of one template with complete flexibility.

In the pull request I linked, go to the tab “Files changed”. 2 files are changed, but only the change to core/src/Revolution/modParser.php is relevant.

In your MODX installation, change the file core/src/Revolution/modParser.php to reflect the changes from the pull request. (All you really need to do is to change the pattern on line 150.)

This change will be included in the next release of MODX 3, but for now you have to change it manually (or install a nightly build).

1 Like

Thank you so much.
I didn’t know what I was doing but change that line (adding the ++) makes all the difference. It works perfect now.