The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
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 &lg; and &lt; 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.

What are you trying to do, exactly? I'm sure there's a way to do it via Smarty.

- Ben

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,

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

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 &lg; 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 &lt; 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>";
$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


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