Templates Mandrill模板中的条件内容
我将字典键(键值对)交给一个服务,该服务反过来利用api通过Mandrill发送电子邮件 现在,如果我的密钥是空的,那么我不希望它包含在电子邮件中。就像在下面的场景中一样,我只希望在我的键有一些值时显示链接文本 我怎样才能写出这样的东西,或者说这是可能的Templates Mandrill模板中的条件内容,templates,if-statement,conditional-statements,mandrill,Templates,If Statement,Conditional Statements,Mandrill,我将字典键(键值对)交给一个服务,该服务反过来利用api通过Mandrill发送电子邮件 现在,如果我的密钥是空的,那么我不希望它包含在电子邮件中。就像在下面的场景中一样,我只希望在我的键有一些值时显示链接文本 我怎样才能写出这样的东西,或者说这是可能的 if *|UPDATE_PROFILE|* IS NOT EMPTY BEGIN <a href="*|UPDATE_PROFILE|*" target="_blank">change subscription preferenc
if *|UPDATE_PROFILE|* IS NOT EMPTY
BEGIN
<a href="*|UPDATE_PROFILE|*" target="_blank">change subscription preferences</a>
END
如果*|更新|配置文件|*不为空
开始
结束
我在这里找到了答案:
以下是页面中的信息:
条件合并标记支持传统的IF、ELSE和ELSEIF逻辑以及IFNOT负条件
使用“如果条件”仅在条件评估为true时显示内容
*|IF:MERGE|*
content to display if a value for MERGE is provided
*|END:IF|*
*|IF:MERGE=x|*
content to display if the value for MERGE is x
*|END:IF|*
当使用诸如| IF:MERGE=x |之类的条件时,如果没有为MERGE提供值,则该条件的计算结果将为false
*|IF:MERGE|*
content to display
*|ELSE:|*
alternative content
*|END:IF|*
当条件为true时,使用IF和ELSE条件显示内容,但当条件评估为false时,使用替换内容
*|IF:MERGE|*
content to display
*|ELSE:|*
alternative content
*|END:IF|*
埃尔塞夫条件
使用ELSEIF显示几个可能的选项之一。只有第一个条件评估为true后的内容才会显示,其他条件将被跳过
*|IF:MERGE=x|*
<p>content to display if the value for MERGE is x</p>
*|ELSEIF:MERGE=y|*
<p>content to display if the value for MERGE is not x, but is y</p>
*|ELSEIF:MERGE=z|*
<p>content to display if the value for MERGE is not x or y, but is z</p>
*|ELSE:|*
<p>alternate content to display if the value for MERGE is not x, y, or z</p>
*|END:IF|*
在我的案例中使用
*|IF:UPDATE_PROFILE|*
<p>IMPORTANT NOTE: *|LAYOUTYEAR|*
available for review at: http://www.somesite.org/SomePage.</p>
*|ELSE:|*
<p>
<a href="http://www.somesite.org/SomePage" target="_blank">Click here</a>
to view the detailed specs.
</p>
*|END:IF|*
*|如果:更新配置文件|*
重要提示:*LAYOUTYEAR*
可于以下网址查阅:http://www.somesite.org/SomePage.
*|其他:|*
查看详细规格。
*|完:如果|*
Mandrill支持条件标记
基本IF条件
*|IF:UPDATE_PROFILE|*
content to display if a value for UPDATE_PROFILE is provided
*|END:IF|*
*|IF:UPDATE_PROFILE=x|*
content to display if the value for UPDATE_PROFILE is x
*|END:IF|*
*|IF:UPDATE_PROFILE|*
content to display
*|ELSE:|*
alternative content
*|END:IF|*
*|IF:UPDATE_PROFILE=x|*
<p>content to display if the value for UPDATE_PROFILE is x</p>
*|ELSEIF:UPDATE_PROFILE=y|*
<p>content to display if the value for UPDATE_PROFILE is not x, but is y</p>
*|ELSEIF:UPDATE_PROFILE=z|*
<p>content to display if the value for UPDATE_PROFILE is not x or y, but is z</p>
*|ELSE:|*
<p>alternate content to display</p>
*|END:IF|*
基本IF-ELSE条件
*|IF:UPDATE_PROFILE|*
content to display if a value for UPDATE_PROFILE is provided
*|END:IF|*
*|IF:UPDATE_PROFILE=x|*
content to display if the value for UPDATE_PROFILE is x
*|END:IF|*
*|IF:UPDATE_PROFILE|*
content to display
*|ELSE:|*
alternative content
*|END:IF|*
*|IF:UPDATE_PROFILE=x|*
<p>content to display if the value for UPDATE_PROFILE is x</p>
*|ELSEIF:UPDATE_PROFILE=y|*
<p>content to display if the value for UPDATE_PROFILE is not x, but is y</p>
*|ELSEIF:UPDATE_PROFILE=z|*
<p>content to display if the value for UPDATE_PROFILE is not x or y, but is z</p>
*|ELSE:|*
<p>alternate content to display</p>
*|END:IF|*
ELSEIF条件
*|IF:UPDATE_PROFILE|*
content to display if a value for UPDATE_PROFILE is provided
*|END:IF|*
*|IF:UPDATE_PROFILE=x|*
content to display if the value for UPDATE_PROFILE is x
*|END:IF|*
*|IF:UPDATE_PROFILE|*
content to display
*|ELSE:|*
alternative content
*|END:IF|*
*|IF:UPDATE_PROFILE=x|*
<p>content to display if the value for UPDATE_PROFILE is x</p>
*|ELSEIF:UPDATE_PROFILE=y|*
<p>content to display if the value for UPDATE_PROFILE is not x, but is y</p>
*|ELSEIF:UPDATE_PROFILE=z|*
<p>content to display if the value for UPDATE_PROFILE is not x or y, but is z</p>
*|ELSE:|*
<p>alternate content to display</p>
*|END:IF|*
我认为这与只提供一个可能有一天会消亡的链接有关,而不提供任何有用的信息。例如,如果你像Hemerson Varela那样在你的链接中添加了信息,那就好了。或者至少是你的问题的解决方案