Thank you! I keep wondering if it would be faster to set up individual email script tokens with the tables of each images (the team keeps complicating this with more formatting needs, size changes, adding text, links, etc), but I'm still figuring out how to best write this all out so I really appreciate the guidance!
#set( $imagePath = "http://lp.accessintel.com/rs/881-ZTT-725/images/" )
#set( $outputByjobFunction = [
{
"pattern" : "(?i).*\b(programmer|engineer)\b.*",
"color" : "#800080",
"greeting" : "techie person",
"images" : [
"sm-black_i_50.gif",
"sm-black_f_50.gif",
"sm-black_t_50.gif"
]
},
{
"pattern" : "(?i).*\b(marketer|sales)\b.*",
"color" : "#B1309D",
"greeting" : "marketing person",
"images" : [
"sm-rnd_fb_grey.png",
"sm-rnd_i_grey.png"
]
},
{
"pattern" : ".*",
"color" : "#99cc00",
"greeting" : "general person",
"images" : [
"sm-square_li_100.gif",
"sm-square_g_100.gif",
"sm-square_fb_100.gif",
"sm-square_t_100.gif"
]
}
] )
#foreach( $outputSet in $outputByjobFunction )
#if( $lead.jobFunction.matches($outputSet.pattern) )
#set( $matchedOutputSet = $outputSet )
#break
#end
#end
<span style="color: ${matchedOutputSet.color};">${matchedOutputSet.greeting}</span>
<table width="60%" border="0" cellspacing="0" cellpadding="6">
<tbody>
<tr>
#foreach( $image in $matchedOutputSet.images )
<td align="center"><img src="${imagePath}${image}" width="30"></td>
#end
</tr>
</tbody>
</table>
I keep wondering if it would be faster to set up individual email script tokens with the tables of each images (the team keeps complicating this with more formatting needs, size changes, adding text, links, etc) |
It's almost never better to repeat yourself, though at the same time you have to stop people from constantly changing the spec on you...