Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Junk <![CDATA[YII-BLOCK-HEAD]]> code around email template #337

Closed
iparr opened this issue Oct 27, 2022 · 12 comments
Closed

Junk <![CDATA[YII-BLOCK-HEAD]]> code around email template #337

iparr opened this issue Oct 27, 2022 · 12 comments
Labels
bug Something isn't working

Comments

@iparr
Copy link

iparr commented Oct 27, 2022

This has been working fine for months, but just since Craft v4 (I think) this error has crept in.

I'm sending a regular scheduled email every week and it pulls in a template.

In preview this looks fine, but when emailed I get:

<
![CDATA[YII-BLOCK-HEAD]]>
<![CDATA[YII-BLOCK-BODY-BEGIN]]>

…and then:

<![CDATA[YII-BLOCK-BODY-END]]>

…at the end of the email.

Why is this appearing and how am I able to hide it (again!)?

In my template I have:

		<!--[if gte mso 9]>
		<xml>
			<o:OfficeDocumentSettings>
			<o:AllowPNG/>
			<o:PixelsPerInch>96</o:PixelsPerInch>
			</o:OfficeDocumentSettings>
		</xml>
		<![endif]-->
	</head>
	<body yahoo bgcolor="{{ color.background_white }}" style="margin:0;padding:0;word-spacing:normal;background-color:{{ color.background_white }};">
	<div role="article" aria-roledescription="email" lang="en" style="-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;background-color:{{ color.background_white }};">

But in my email message raw source I get:

<!--[if gte mso 9]>
		<xml>
			<o:OfficeDocumentSettings>
			<o:AllowPNG/>
			<o:PixelsPerInch>96</o:PixelsPerInch>
			</o:OfficeDocumentSettings>
		</xml>
		<![endif]-->
	&lt;</head><body><p>![CDATA[YII-BLOCK-HEAD]]&gt;
	</p>&lt;![CDATA[YII-BLOCK-BODY-BEGIN]]&gt;
	<div role=3D"article" aria-roledescription=3D"email" lang=3D"en" style=3D"=-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;background-color:#f=ffffe;">
@iparr iparr added the bug Something isn't working label Oct 27, 2022
@bencroker
Copy link
Collaborator

There's a branch in progress to address this at https://github.com/putyourlightson/craft-campaign/tree/bugfix/yii-blocks, which a few people are in the process of testing. If you could test as well then that would help speed up the fix.

@iparr
Copy link
Author

iparr commented Oct 27, 2022

I have tried, but it renders the admin/campaign/sendouts/recurring/preview/xxxxxx page without CSS or JS (the rest of the Dashboard is fine), so I can't send a test email. Don't want to add fuel to the fire, I may have to sit this one out!

@bencroker
Copy link
Collaborator

How are you inserting the CSS and JS?

In the meantime, clearing Compiled templates in the Caches utility should fix the issue, albeit temporarily.

Screenshot 2022-10-27 at 20 04 05

@bencroker
Copy link
Collaborator

bencroker commented Oct 28, 2022

Ah, you meant that CSS and JS were missing from the sendout edit page. I've fixed that in e30ff43, can you please run composer update and try again?

@iparr
Copy link
Author

iparr commented Oct 28, 2022

First the good news:

  1. That Dashboard page now renders correctly.
  2. A test of the email sends through one that looks as it did and without the <!CDATA[YII… code.

The bad news:

  1. The preview pane ("HTML Body") now injects in a lot of CSS that was not there previously and so the template looks very different to the one that is actually sent through via email. For example:

main.css provides:

.header, .hud-header {
    border-radius: var(--large-border-radius) var(--large-border-radius) 0 0;
    box-shadow: inset 0 -1px 0 var(--hairline-color);
    padding: 24px;
}

This wasn't there before, the view within this pane was completely isolated from any other styling.

(I am clearing my caches before any test)

@bencroker
Copy link
Collaborator

bencroker commented Oct 28, 2022

The preview pane ("HTML Body") now injects in a lot of CSS that was not there previously and so the template looks very different to the one that is actually sent through via email.

Good catch, those are CP assets being injected, fixed in 35bc198.

@iparr
Copy link
Author

iparr commented Oct 28, 2022

👍 Can confirm, it's now fixed with respect to all these things.

@bencroker
Copy link
Collaborator

Excellent, thanks for helping test this!

@bencroker
Copy link
Collaborator

Released in version 2.2.0.

@BAM-Dennis
Copy link

BAM-Dennis commented Nov 17, 2022

@bencroker any chance you can also migrate it back to 1.x version for craft 3 support? i am still having this issue

@bencroker
Copy link
Collaborator

Yes, I'll backport this fix for v1.

@bencroker
Copy link
Collaborator

Released in version 1.24.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants