[FirstName,Fallback=Awesome Dude]
2006-06-11 03:24:22 GMT
Hi,
I have coded a mod that I think would be useful. Based on the style of fallback replacements used in Campaign Monitor I code this for the /admin/sendemaillib.php file... round about line 327, insert this... (inside the
if (is_array($user_att_values)) { braces )
while(preg_match_all("/\[[a-zA-Z0-9,]*Fallback=[a-zA-Z ]*\]/i",$htmlmessage,$regs)) {
foreach($regs[0] as $tag) {
$tokens = split(",",$tag);
$fieldname = str_replace("[","",$tokens[0]);
$fallback = str_replace("]","",substr($tokens[1],9));
$found = false;
foreach ($user_att_values as $att_name => $att_value) {
if(strcasecmp($fieldname, $att_name)==0 && strlen($att_value)){
$htmlmessage = str_replace($tag,$att_value,$htmlmessage);
$found = true;
}
}
if(!$found)
$htmlmessage = str_replace($tag,$fallback,$htmlmessage);
}
}
while(preg_match_all("/\[[a-zA-Z0-9,]*Fallback=[a-zA-Z ]*\]/i",$textmessage,$regs)) {
foreach($regs[0] as $tag) {
$tokens = split(",",$tag);
$fieldname = str_replace("[","",$tokens[0]);
$fallback = str_replace("]","",substr($tokens[1],9));
$found = false;
foreach ($user_att_values as $att_name => $att_value) {
if(strcasecmp($fieldname, $att_name)==0 && strlen($att_value)){
$textmessage = str_replace($tag,$att_value,$textmessage);
$found = true;
}
}
if(!$found)
$textmessage = str_replace($tag,$fallback,$textmessage);
}
}
Chris
RSS Feed