HTML Content in Custom Fields

chris.p

New Member
Hello!

I thought I had read somewhere that html content was supported in custom fields. Is that not the case? Whether I run an import or try to manually save the field, the html tags get stripped out.

The field is used to build out a table of varying size, so it would be a pain to try and build into the template itself.

Perhaps I'm missing something obvious? Any help would be much appreciated.

Thanks!
 
@chris.p - custom fields are limited to 255 bytes in length, so this means roughly 255 characters at most, which makes them not suitable for storing html. This is also the reason it gets stripped.
I am sure there are other ways to accomplish what you're after. I assume you need big blobs of html injected in various parts of your template? There is a tag called [REMOTE_CONTENT] which can be used to fetch content from a url, so you could potentially load your html content from remote location. The content is cached and reused, so you won't get any performance issues.
Code:
[REMOTE_CONTENT url='https://www.domain.com/some-html-framgment.html']
 
Ah, ok, that makes sense.

The html content is unique to each subscriber. It's not huge by any means, but it is over 255 char. In that remote_content tag, can I make that url dynamic? Maybe using a custom field in it? Are there other options?
 
TBH i don't know if custom fields will work in that custom field, you'll have to try and see.
Other than this, i assume it should be some custom work around the tags parsing, or maybe enable twig and extend it to match your use case.
 
I have a similar question:
For a custom field that either has value A or value B within a list, I'd like to show REMOTE FILE A.htm or B.htm.
How can I achieve that?
 
I have a similar question:
For a custom field that either has value A or value B within a list, I'd like to show REMOTE FILE A.htm or B.htm.
How can I achieve that?

I tried to do this several ways, but wasn't able to make it work. Nesting custom fields didn't work for me. Though I was having problems getting remote content to load correctly at all.

My case was pretty time-sensitive, so I had to find an alternative solution, but if you find something that works, please update this thread - it would be great to know.
 
I have a similar question:
For a custom field that either has value A or value B within a list, I'd like to show REMOTE FILE A.htm or B.htm.
How can I achieve that?
With custom coding only. I don't see how mailwizz would be able to understand that you'd like to load a remote file, unless we design a custom field for this purpose, but if we do, how would that work?
 
Maybe I'm misunderstanding the [REMOTE_CONTENT=url:....] tag you mentioned earlier. But that's what I'm ref. to.
I'd hoped there could be some sort of a {% if ... %}... {% else %} solution.

Something like...

{% if TYPE == 'artist' %}
[REMOTE_CONTENT=url:[URL]https://mydomain.com/A.htm[/URL]]
{% elseif TYPE == 'promoter' %}
[REMOTE_CONTENT=url:[URL]https://mydomain.com/B.htm[/URL]]
{% endif %}
 
Last edited:
Maybe I'm misunderstanding the [REMOTE_CONTENT=url:....] tag you mentioned earlier. But that's what I'm ref. to.
I'd hoped there could be some sort of a {% if ... %}... {% else %} solution.

Something like...

{% if TYPE == 'artist' %}
[REMOTE_CONTENT=url:[URL]https://mydomain.com/A.htm[/URL]]
{% elseif TYPE == 'promoter' %}
[REMOTE_CONTENT=url:[URL]https://mydomain.com/B.htm[/URL]]
{% endif %}

This would be interesting. I could pick up values from the database depending on the User ID selected. There are so many possibilities.
 
Also maybe consider the ability to dynamically populate that remote_content url tag with a custom field. Then you could pass that info as a url parameter and have an external script generate html content depending on it's value. I'm not sure how that would work with the caching you referenced earlier, but it's a thought.
 
Also maybe consider the ability to dynamically populate that remote_content url tag with a custom field. Then you could pass that info as a url parameter and have an external script generate html content depending on it's value. I'm not sure how that would work with the caching you referenced earlier, but it's a thought.

Again only an idea: How would it be if the Remote Content tag could have two variants - one with caching and no input parameters and the second without caching and with input parameters.
 
Something like...

{% if TYPE == 'artist' %}
[REMOTE_CONTENT=url:[URL]https://mydomain.com/A.htm[/URL]]
{% elseif TYPE == 'promoter' %}
[REMOTE_CONTENT=url:[URL]https://mydomain.com/B.htm[/URL]]
{% endif %}
You can already do this, just enable twig template engine and that's it, you should be able to do the rest just fine.

Code:
{% if TYPE == 'artist' %}
[REMOTE_CONTENT url='https://mydomain.com/A.htm']
{% elseif TYPE == 'promoter' %}
[REMOTE_CONTENT url='https://mydomain.com/B.htm']
{% endif %}

Did you try it ?
 
Hello,
You have to enable the template engine first from Backend->Settings->Campaigns->Template-engine
Cosmin
 
I have not yet been able to get external content to work at all - even outside of this statement.
The only reason i can think of for this is that your hosting blocks outgoing connections, but i assume that's not true, right?
Can you give us the real url to such file so we can test it in our dev ?
 
Here's how the tag looks in code:
Screenshot 2019-11-12 11.42.29.png
And in the template:
Screenshot 2019-11-12 11.43.09.png

And the result:
Screenshot 2019-11-12 11.45.12.png

So it def. works, just make sure in source mode, your tag does not contain garbage html which could prevent it being parsed properly by mailwizz.
 
Back
Top