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



Form Tools
Email attachments: Can I conditionally included them? - 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: Email attachments: Can I conditionally included them? (/showthread.php?tid=1282)



Email attachments: Can I conditionally included them? - russellfeeed - May 10th, 2011

Hi
I'm trying to include attachments depending on the value of a form field, like so

Code:
{if $ANSWER_onf_network=='O2'}
{$attachment file="../../es/xyz/emailattachments/AIRTIMEPAYMONTHLY_OCT10.pdf"}
{$attachment file="../../es/xyz/emailattachments/O2 Standard Business terms.pdf"}
{/if}

But my {if} smarty statement seems to be being ignored and the attachment is included anyway.

Any ideas?

Cheers
Russell


RE: Email attachments: Can I conditionally included them? - crunchers - May 10th, 2011

Not too sure on Smarty, but try removing the curly brackets between lines 2 and 3 and terminate each line with a semi-colon instead:

PHP Code:
{if $ANSWER_onf_network=='O2'}
$attachment file="../../es/xyz/emailattachments/AIRTIMEPAYMONTHLY_OCT10.pdf";
$attachment file="../../es/xyz/emailattachments/O2 Standard Business terms.pdf";
{/if} 



RE: Email attachments: Can I conditionally included them? - Ben - May 16th, 2011

Hey Russell,

Actually, I don't believe so... excellent question, though.

The email attachment option for the Swift Mailer module was kind of grafted on. It doesn't get parsed properly within Smarty: the code just parses the email template content for that particular string, then appends the appropriate file. So the Smarty if statement won't be acknowledged.

I forget the reason why I did it this way: there was a good reason at the time, since it's clearly crumby. I'll definitely have to revisit this.

- Ben



RE: Email attachments: Can I conditionally included them? - russellfeeed - May 16th, 2011

Thanks @crunchers - I've not tried it yet but will reply when I do.

Thanks @Ben - In other projects I've managed this using a View and Filter. I can't do this for this project unfortunately. Let me know if you need help with looking at this.




RE: Email attachments: Can I conditionally included them? - zoltandragon - Sep 17th, 2012

Hi,

I have a problem with attaching ANY file whatsoever with my autoresponders: SwiftMailer (1.1.2) is enabled, smtp works like a charm, Core is 2.2.5, I copy then modify the code for the enabled email templates, test it - the email arrives with all the needed data fields, but no attachment comes along. What is wrong - can anyone help me out on this?

(Sorry if this thread is not appropriate for such a question - I did not want to start a new one, but will, if that is more acceptable)


RE: Email attachments: Can I conditionally included them? - lobaluna - May 21st, 2016

I used double quotes for comparison, and smarty {if} statement works well:
Code:
{if $ANSWER_onf_network=="O2"}