Jump to content

PageMjmlToHtml


monollonom
 Share

Recommended Posts

Following the previous addition to convert relative URLs into absolute ones I quickly needed to ignore some that weren’t just starting with either "http", "tel" or "mailto" but were also keywords from mailing tools such as "*|UNSUBSCRIBE|*".

However I also did some changes in the module’s config, mostly for clarity but also to avoid a call to the MJML API on every save. So before I publish a new release, I wouldn’t mind if any users (@wbmnfktr, @szabesz?) would try it out in a local environment and confirm everything is still working (it is on my side) before I create a new release and update it in the module directory.

Thanks!

  • Like 1
Link to comment
Share on other sites

Hello @monollonom,

I updated the site I'm using this module of yours from v1.1.8 to the this RC version and could not notice any difference.

I do not know if it makes any difference or not, but I'm using the module with the "Bypass cache for superusers?" option turned on, because as a superuser, I will ever be the only one to have the module convert MJML to HTML. It is because I am using it for generating HTML templates for transactional emails which are only changed by me.

I implemented a simple interface in the admin for rendering and previewing requested MJML templates which are first saved as HTML files and after that parsed for some simple "custom template tags" I made up, so that tags can be populated with actual values and the whole email can be sent in the end. So these MJML templates rarely change (except during development, of course) and that's why I do not use caching at all. When sending a transactional email, its saved HTML template is used.

cheers
Szabesz

Edited by szabesz
  • Like 1
Link to comment
Share on other sites

So... I updated to the version you linked in your post.
No errors while updating.

New module settings page looks great and works as expected so far.

I added query paramters just to test them:

mjml1.png.7bd985dd25404dc5aedf80a5f1235425.png

And got this:

mjml2.png.da722211e7aba289ed0f8d209d125fd6.png

Only updated relative links are affected - as far as I can see right now.

  • Thanks 1
Link to comment
Share on other sites

3 hours ago, wbmnfktr said:

And got this:

mjml2.png.da722211e7aba289ed0f8d209d125fd6.png

Only updated relative links are affected - as far as I can see right now.

Ah! You uncovered my evil plan to put my website on every newsletter generated from my module ?

Joke aside, thanks for spotting this one, it was because of $page->getText returning an empty string when there were no {brackets} in the string.

I also spotted another bug if you left the "ignore" textarea empty.

Here’s the updated file. Let me know if you notice anything else and otherwise I’ll publish the release!

Edit: noticed and fixed another small issue with slashes (if missing in the custom host, or if the relative url doesn’t start with one)

14 hours ago, szabesz said:

I do not know if it makes any difference or not, but I'm using the module with the "Bypass cache for superusers?" option turned on, because as a superuser, I will ever be the only one to have the module convert MJML to HTML. It is because I am using it for generating HTML templates for transactional emails which are only changed by me.

It shouldn’t make any difference indeed but thank you anyway for sharing your usage of the module!

Edited by monollonom
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

12 minutes ago, monollonom said:

Ah! You uncovered my evil plan to put my website on every newsletter generated from my module ?

A small step to world domination! Love the idea. ?

So, just updated the file, tested again, added a {bracket} value.

No issues. Everything works as expected!

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Hi @monollonom,

thanks for the great module. I just have a strange problem: when I try to preview the rendered page as a guest user, I can only see <h1>title</h1> and the rest disappears it seems the module cannot be used to create a "view in browser" version, right?

Ok, just saw that the editor says that "align is illegal", but it works perfectly with the normal MJML app...

Link to comment
Share on other sites

If you don’t see an output as a guest user it means there was an error trying to convert the MJML code.

4 hours ago, cpx3 said:

Ok, just saw that the editor says that "align is illegal", but it works perfectly with the normal MJML app...

Is there a way you could share your code? A screenshot maybe?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...