Posts: 10
Threads: 3
Joined: Sep 2009
Reputation:
0
Hi,
I want to add a code block example at the end of my emails. I've tried changing < > to ≶ and < but it always converts it and renders it as html. Anyone know if there is a way to actually do this?
Thanks,
nytsua
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Hi nytsau - I don't believe you can... you can only enter Smarty content - PHP isn't allowed.
What are you trying to do, exactly? I'm sure there's a way to do it via Smarty.
- Ben
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Hi Nytsua,
Any HTML entered into the HTML templates *should* be rendered as HTML. But if you add HTML into the text template, it'll probably just appear as is - since email clients will render it as text.
Is that the problem, do you think?
- Ben
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Heya,
Well, I have a solution, but it's not ideal. Somewhere along the line, either through the WYSIWYG CodeMirror editor that's used to display the HTML & Text content fields on the email tab, or with the backend code itself, the characters are automatically being converted. So < becomes <, etc.
So what you can do is bypass it altogether using the Hooks Manager module, which you can download here:
http://modules.formtools.org/hooks_manag...page=index
That module lets you add your own code to be executed at any point within Form Tools. In this case, what we're going to do is use it to create some additional placeholders for use in your email template. These placeholders will contain your raw HTML.
Here's how to do it:
1. Download & install the module.
2. In the module, create a new rule with the following values:
Status: Enabled
Rule Name: Email placeholders
Priority: 50
Hook Type: Code Hook
Code Hook: _ft_get_placeholder_hash, end
PHP Code:
PHP Code:
<?php
$html = "<b>HTML here</b>";
$placeholders["encoded_html"] = htmlspecialchars($html);
The $html variable can actually contain whatever raw HTML you want embedded.
Then, after adding the rule, return to your email template and in the HTML template add the following line:
{$encoded_html}
That's a new placeholder that you just created: your email will then display the HTML within your emails. You can define as many placeholders as you want in that single Hooks Manager rule - all of them will be available to your email templates.
Hope this helps! :-)
- Ben