Repeater & Layout tags issue/bug.
I had an email template with nested tables and I wanted to wrap the content table with the <repeater> tag and have more code BEFORE I started the different <layout> tags sections.
It appeared to be fine when I used an online HTML Lint validator, however, when I tried to upload the html file, the template upload displayed errors saying the <layout> tags were not inside the <repeater> tags.
But they WERE!
The code below shows what I did:
Please note: this is a very simplified version and I have not tested this code I am using for my first example.
<!-- this didn't work. :-( --> <repeater> <p>But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness.</p> <layout label="one"> <!-- stuff here --> </layout> <p>No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful.</p> <layout label="two"> <!-- different stuff here --> </layout> <p>Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure.</p> </repeater>
After a few attempts to upload & clean up my HTML, i stumbled upon the fix that made it validate & upload the template:
<!-- strangely this did work. :-\ --> <repeater> <layout label="one"> <!-- stuff here --> </layout> <layout label="two"> <!-- different stuff here --> </layout> </repeater>
First: Is this a bug?
Second: Is there a bug/issue tracker for CM?
Third: I hope this helps someone.
Hi Frederick, thank you for writing in. The issue here is that the template parser doesn't expect text outside of <layout> tags within the repeater - it's likely getting confused because the first thing it's coming across after <repeater> is <p>, not <layout>. Your best bet here is to keep this static content outside of the repeaters, or make it editable by placing <layout> tags around it.
You're right, the error message doesn't really indicate this, so I'll certainly take note and see if we can get this updated. Pretty certain this will help others, so thank you for posting here! :D