The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
code block in email - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5) +--- Thread: code block in email (/showthread.php?tid=366) |
code block in email - nytsua - Nov 12th, 2009 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 RE: code block in email - Ben - Nov 14th, 2009 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 RE: code block in email - nytsua - Nov 14th, 2009 (Nov 14th, 2009, 12:24 PM)Ben Wrote: Hi nytsau - I don't believe you can... you can only enter Smarty content - PHP isn't allowed. Hi Ben, What I'm trying to do is to add a short text of code that can be copied at the end of the email. Something like: Copy the following code and paste on your site: Code: <a href="">Our site</a> No php just simple html that is not interpreted as html. I figured it might not be possible but thought I'd ask. Thanks, nytsua RE: code block in email - Ben - Nov 17th, 2009 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 RE: code block in email - nytsua - Nov 17th, 2009 (Nov 17th, 2009, 11:58 AM)Ben Wrote: Hi Nytsua, You're right, I'm trying to do this in the html template. I understand that html will be rendered as html, rightly so, however is there a way to encode it so it looks like the code but isn't rendered? So far what I've tried doing is encoding the '<' and '>' to ≶ and lgt; but it still converts that to html. I also tried using the <code> tag but that didn't work (not too surprising). Thanks, nytsua RE: code block in email - Ben - Nov 17th, 2009 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_manager/index.php?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: $html = "<b>HTML here</b>"; 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 RE: code block in email - nytsua - Nov 17th, 2009 Awesome! This looks like exactly what I need. I'll give it a try and let you know. Thanks Ben! Nytsua RE: code block in email - nytsua - Nov 28th, 2009 Hi Ben, Thanks again for you help! This does exactly what I was trying to do. nytsua |