| Anonymous | Login | Signup for a new account | 02-09-10 22:05 GMT | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||
| 0011733 | phplist | Message Send Process | public | 01-10-07 07:21 | 10-05-10 02:03 | ||||||
| Reporter | bhugh | ||||||||||
| Priority | high | Severity | feature | Reproducibility | always | ||||||
| Status | new | Resolution | open | ||||||||
| Platform | OS | OS Version | |||||||||
| Product Version | 2.10.5 | ||||||||||
| Target Version | 2.11.X | Fixed in Version | |||||||||
| Summary | 0011733: Conditional includes & placeholders, easy hack | ||||||||||
| Description | I put together a pretty easy way to conditionally include placeholders and other information, depending on whether a certain attribute exists or not. So you can email "Dear Jane," to your subscribers who have entered their first name and "Good day!" to those who haven't. | ||||||||||
| Additional Information | sendemaillib.php, about line 315, find foreach ($user_att_values as $att_name => $att_value) { if (eregi("\[".$att_name."\]",$htmlmessage,$regs)) { $htmlmessage = eregi_replace("\[".$att_name."\]",$att_value,$htmlmessage); } and replace with: foreach ($user_att_values as $att_name => $att_value) { //"CONDITIONAL" substitution thing for HTML messages, 9-30-2007 //Works like this, in email body: //[CONDITIONAL Dear [FIRST NAME]|Greetings!] includes "Dear [FIRST NAME]," if [FIRST NAME] exists //or "Greetings!" otherwise //Works for any attribute name, upper case, in brackets [LAST NAME], [ZIP], etc. if (preg_match_all ('/\[CONDITIONAL\|\[' . preg_quote($att_name, '/') . '\]\|(.*?)\|(.*?)\]/si', $htmlmessage,$matches, PREG_SET_ORDER)) { foreach ($matches as $regs) { if ($att_value<>"") { $conditional=$regs[1]; str_replace ( '[' . strtoupper($att_name) .']', $att_value, $conditional); } else { $conditional=$regs[2]; } $htmlmessage = str_replace($regs[0] , $conditional, $htmlmessage); } } if (preg_match_all ('/\[CONDITIONAL\|\[' . preg_quote($att_name, '/') . '\]\|(.*?)\|(.*?)\]/si', $textmessage,$matches, PREG_SET_ORDER)) { foreach ($matches as $regs) { if ($att_value<>"") { $conditional=$regs[1]; str_replace ( '[' . strtoupper($att_name) .']', $att_value, $conditional); } else { $conditional=$regs[2]; } $textmessage = str_replace($regs[0] , $conditional, $textmessage); } } if (eregi("\[".$att_name."\]",$htmlmessage,$regs)) { $htmlmessage = eregi_replace("\[".$att_name."\]",$att_value,$htmlmessage); } | ||||||||||
| Tags | No tags attached. | ||||||||||
| Attached Files | |||||||||||
Relationships |
|||||||||||
|
|||||||||||
| Copyright © 2000 - 2010 MantisBT Group |